Prev: Call for Paper The International Journal of Computer Science (IJCS)
Next: python & perl bigint difference
From: #! /shell/nerd on 2 Mar 2010 12:41 Hi, I have an interesting performance problem - I'm creating a file /tmp/ out in a server & putting the JVM startup progress in it. The typical content of this file could be - JVM01 .....STARTED And I have 10 such JVMs in a machine so they all simultaneously try to write to this file at one instance. Now I found that Atleast one is missed during the simulataneous write at the beginning e.g. JVM08 might not be able to get a chance to put it's entry in the file. Now the work around I have is to check the entry for that JVM in this file in a look (say 10 times) & put the entry if not found. Is there a better way of doing it?
From: pk on 2 Mar 2010 12:42 #! /shell/nerd wrote: > I have an interesting performance problem - I'm creating a file /tmp/ > out in a server & putting the JVM startup progress in it. The typical > content of this file could be - > JVM01 .....STARTED > And I have 10 such JVMs in a machine so they all simultaneously try to > write to this file at one instance. Now I found that Atleast one is > missed during the simulataneous write at the beginning e.g. JVM08 > might not be able to get a chance to put it's entry in the file. Now > the work around I have is to check the entry for that JVM in this file > in a look (say 10 times) & put the entry if not found. Is there a > better way of doing it? How are you writing to the file? If you're independently running many instances of code like ".... > /tmp/out", then I'm not surprised that some information is missing, although in this case the outcome would be different from what you describe (IIUC).
From: #! /shell/nerd on 2 Mar 2010 12:54 On Mar 2, 11:42 am, pk <p...(a)pk.invalid> wrote: > #! /shell/nerd wrote: > > I have an interesting performance problem - I'm creating a file /tmp/ > > out in a server & putting the JVM startup progress in it. The typical > > content of this file could be - > > JVM01 .....STARTED > > And I have 10 such JVMs in a machine so they all simultaneously try to > > write to this file at one instance. Now I found that Atleast one is > > missed during the simulataneous write at the beginning e.g. JVM08 > > might not be able to get a chance to put it's entry in the file. Now > > the work around I have is to check the entry for that JVM in this file > > in a look (say 10 times) & put the entry if not found. Is there a > > better way of doing it? > > How are you writing to the file? If you're independently running many > instances of code like ".... > /tmp/out", then I'm not surprised that some > information is missing, although in this case the outcome would be different > from what you describe (IIUC). Yeah forgot to mention that .. Before starting any JVM, In it's own process I'm doing printf "JVMXX \n" >> /tmp/out So each JVM writes to the file first & then continues with the start.
From: #! /shell/nerd on 2 Mar 2010 21:32 On Mar 2, 11:54 am, "#! /shell/nerd" <vikas...(a)gmail.com> wrote: > On Mar 2, 11:42 am, pk <p...(a)pk.invalid> wrote: > > > > > #! /shell/nerd wrote: > > > I have an interesting performance problem - I'm creating a file /tmp/ > > > out in a server & putting the JVM startup progress in it. The typical > > > content of this file could be - > > > JVM01 .....STARTED > > > And I have 10 such JVMs in a machine so they all simultaneously try to > > > write to this file at one instance. Now I found that Atleast one is > > > missed during the simulataneous write at the beginning e.g. JVM08 > > > might not be able to get a chance to put it's entry in the file. Now > > > the work around I have is to check the entry for that JVM in this file > > > in a look (say 10 times) & put the entry if not found. Is there a > > > better way of doing it? > > > How are you writing to the file? If you're independently running many > > instances of code like ".... > /tmp/out", then I'm not surprised that some > > information is missing, although in this case the outcome would be different > > from what you describe (IIUC). > > Yeah forgot to mention that .. > Before starting any JVM, In it's own process I'm doing printf "JVMXX > \n" >> /tmp/out > So each JVM writes to the file first & then continues with the start. I'd appreciate if somebody could suggest anything !!
From: Geoff Clare on 3 Mar 2010 08:39 #! /shell/nerd wrote: >> > > And I have 10 such JVMs in a machine so they all simultaneously try to >> > > write to this file at one instance. Now I found that Atleast one is >> > > missed during the simulataneous write at the beginning e.g. JVM08 >> > > might not be able to get a chance to put it's entry in the file. >> Before starting any JVM, In it's own process I'm doing printf "JVMXX >> \n" >> /tmp/out >> So each JVM writes to the file first & then continues with the start. > > I'd appreciate if somebody could suggest anything !! What shell are you executing that printf in? If it is not a POSIX-conforming shell then it's possible that it is implementing ">>" by just seeking to the end of the file instead of setting O_APPEND on the file descriptor. -- Geoff Clare <netnews(a)gclare.org.uk>
|
Next
|
Last
Pages: 1 2 Prev: Call for Paper The International Journal of Computer Science (IJCS) Next: python & perl bigint difference |