Re: [Prevayler-coders] Re: Prevayler writing performance improvements
Brought to you by:
jsampson,
klauswuestefeld
From: Justin S. <ju...@kr...> - 2005-02-02 16:45:11
|
As much as I want this to be true, I have this nagging feeling that it's too good to be true. :} I did some searching, and apparently RandomAccessFile performance is wildly different on different operating systems: http://www.mail-archive.com/jug...@tu.../msg01314.html And apparently there are some reliability issues on some operating systems: http://issues.apache.org/jira/browse/DERBY-1 Of course that doesn't prevent it from being a configuration option, as Greg suggested. So if you're using an operating system where RandomAccessFile is reliable and fast, and you're using a local disk, then use it... I'm curious, Greg, do you see any performance difference between "rw", "rws", and "rwd"? If there's no difference we can suspect it's not really doing what it's supposed to. If there's some difference we have evidence that it is doing what it's supposed to. As for metadata, the javadoc doesn't make it at all clear what it means, so surely it's specific to the operating system and filesystem used. In the context of journaling filesystem design, "metadata" refers to things like the file size and block allocations, which are definitely important to us. The second page I referenced above claims that "rwd" is still required to sync whatever metadata is "required" to recover the data, but from my reading that's not guaranteed by the javadoc. Thanks, Justin On Wed, 2 Feb 2005, Klaus Wuestefeld wrote: > :)) > > > On Tue, 1 Feb 2005 22:49:56 +0000 (GMT), greg higgins > <gre...@ya...> wrote: > > Hi Justin, > > > > Thanks for getting in touch. > > > > I downloaded the latest source from cvs and ran my > > tests again. I have included the updated source and > > the detailed results as attachements. > > > > Here are the summary results for Random Backed vs > > standard serialization > > > > Test RandomBacked Thread (Min-Max) > > Operations/second > > 1 No 1-3 > > 40.18 > > 2 No 50-52 > > 259.81 > > 3 Yes 1-3 > > 814.37 > > 4 Yes 1-3 > > 1566.93 > > > > Improvement by using RandomBacked Serialization > > > > Test1 and Test 3 = 814/40 = 2026% > > Test2 and Test 4 = 1566.93/259.81 = 600% > > > > This is on my laptop with XP running. > > > > You can run the same tests in the attached source, I > > am using a property "useRandomBacked = YES" in the > > ScalabilityTest.properties to control the test run. > > > > As you can see the random backed does appear hugely > > more efficient. I can see the batching working its > > magic - although I think RandomFile will always ne > > quicker on windows. > > > > I dont think the meta-data is important, but more > > investigation is required isnt it just for updating > > file browsers? Anyway I ran the above tests with rws > > forcing meta-data to be written. > > > > The main issue I can see is that RandomAccessFile only > > guarantees writes for a local drive. I therefore > > suggest introducing an interface > > <IDurableOutputStream> and allow the user(or can java > > detect remote filesystems?) to decide which > > implemnting class to use <DurableOutputStream> or > > <RandomBackedDurableOutputStream>. > > > > The synchronization seems to be really improved - nice > > one!! > > > > mmmm forget my comments about using a single log file > > I was going down a blind alley here. > > > > Are generics binary compatible with 1.4, so the source > > could be updated? > > > > Has anybody do any work on using memory mapped files > > to load/persist snapshots? I will try myself when I > > get some more time. > > > > Give it a try I would be interested to see how you get > > on. > > > > regards, > > > > Greg > > > > > > --- Justin Sampson <ju...@kr...> wrote: > > > On Mon, 31 Jan 2005, greg higgins wrote: > > > > > > > I am using prevayler2.02.005 > > > > > > DurableOutputStream has been pretty much completely > > > rewritten since then, > > > for somewhat better performance. Could you try it > > > with the new code (from > > > CVS), to see how fast it is on your machine? > > > > > > http://www.prevayler.org/wiki.jsp?topic=CVS > > > > > > Also, please try the RandomAccessFile with "rws" > > > instead of "rwd" -- isn't > > > the file's metadata important? > > > > > > Oh, and try the scalability demo with more threads > > > -- say, 99-101 rather > > > than 1-5. That's when the throughput really flies, > > > because the > > > transactions can be written in batches. > > > > > > > I am very sure that the difference is due to the > > > RandomAccessFile and > > > > not the ByteArrayOutputstream. The > > > ByteArrayOutputstream is used only > > > > because the RandomAccessFile does nto support > > > streams by default only > > > > byte operations. The problem with explicitly > > > calling flush and sync on > > > > the filedescriptor is it uses a slow and > > > inefficient path through > > > > windows to guarantee writes, whereas the > > > RandomAccessFile seems to use > > > > an optimised set if calls, here is an extract from > > > the javadoc for > > > > RandomAccessFile: > > > > > > Neat. I remember noticing that, but I've never tried > > > it. We just have to > > > be sure it's really the same durability as FD.sync() > > > on all platforms. > > > > > > > I think you could remove a lot of the > > > synchronization code in the > > > > DurableOutputStream - and just use a single log > > > file - you would then > > > > see a further gain of 50-100% over the already > > > adjusted figures. > > > > > > A lot of the synchronization has already been > > > removed. > > > > > > What do you mean by "a single log file"? > > > > > > > I was also wonder if there is a way to work > > > generics into the > > > > Transaction api to get rid of lots of casting and > > > add some type saftery > > > > - again im no expert here just an idea > > > > > > I've been dreaming about that, too. Maybe that will > > > be Prevayler 5, since > > > it requires Java 5. :) > > > > > > Justin > > > > > > ============================================================= > > TEST 1 STANDARD SERIALIZATION 1-3 THREADS > > ============================================================= > > > > RunPrevaylerQueryTest property is set to NO. > > This test will be skipped (see properties file). > > > > useRandomBacked property is set to NO. > > This test will be skipped (see properties file). > > > > useRandomBacked property is set to NO. > > This test will be skipped (see properties file). > > > > Prevayler TransactionLog Directory: TransactionTest > > > > Prevayler Journal Serializer: org.prevayler.foundation.serialization.JavaSerializer > > > > ========= Running Transaction Test (3 rounds). Subject: Prevayler... > > Creating 100000 objects... > > Creating 100000 objects... > > Each round will take approx. 20 seconds to run... > > > > Memory used: 113995776 > > Disk space used: 444507 > > Seconds ellapsed: 23.313 > > --------- Round Result: 20.16 operations/second (1 threads) > > > > Memory used: 113995776 > > Disk space used: 1197941 > > Seconds ellapsed: 26.938 > > --------- Round Result: 29.55 operations/second (2 threads) > > > > Memory used: 113995776 > > Disk space used: 2109780 > > Seconds ellapsed: 23.945 > > --------- Round Result: 40.18 operations/second (3 threads) > > > > ----------- BEST ROUND: 40.18 operations/second (3 threads) > > Checking transaction log consistency. > > Creating 100000 objects... > > Transaction log OK. > > > > ============================================================= > > TEST 2 STANDARD SERIALIZATION 50-52 THREADS > > ============================================================= > > > > useRandomBacked property is set to NO. > > This test will be skipped (see properties file). > > > > Prevayler TransactionLog Directory: TransactionTest > > > > Prevayler Journal Serializer: org.prevayler.foundation.serialization.JavaSerializer > > > > ========= Running Transaction Test (3 rounds). Subject: Prevayler... > > Creating 100000 objects... > > Creating 100000 objects... > > Each round will take approx. 20 seconds to run... > > > > Memory used: 113995776 > > Disk space used: 6395065 > > Seconds ellapsed: 27.349 > > --------- Round Result: 246.77 operations/second (50 threads) > > > > Memory used: 113995776 > > Disk space used: 13046074 > > Seconds ellapsed: 26.989 > > --------- Round Result: 259.81 operations/second (51 threads) > > > > Memory used: 113995776 > > Disk space used: 19866355 > > Seconds ellapsed: 27.99 > > --------- Round Result: 256.77 operations/second (52 threads) > > > > ----------- BEST ROUND: 259.81 operations/second (51 threads) > > Checking transaction log consistency. > > Creating 100000 objects... > > Transaction log OK. > > > > ============================================================= > > TEST 3 RANDOM FILE BACKED SERIALIZATION 1-3 THREADS > > ============================================================= > > > > RunPrevaylerQueryTest property is set to NO. > > This test will be skipped (see properties file). > > > > Prevayler TransactionLog Directory: TransactionTest > > > > Prevayler Journal Serializer: org.prevayler.foundation.serialization.JavaSerializer > > > > ========= Running Transaction Test (3 rounds). Subject: Prevayler... > > Creating 100000 objects... > > Creating 100000 objects... > > Each round will take approx. 20 seconds to run... > > > > Memory used: 113995776 > > Disk space used: 3600762 > > Seconds ellapsed: 20.009 > > --------- Round Result: 474.29 operations/second (1 threads) > > > > Memory used: 113995776 > > Disk space used: 3600762 > > Seconds ellapsed: 20.009 > > --------- Round Result: 670.75 operations/second (2 threads) > > > > Memory used: 122687488 > > Disk space used: 3600762 > > Seconds ellapsed: 20.008 > > --------- Round Result: 814.47 operations/second (3 threads) > > > > ----------- BEST ROUND: 814.47 operations/second (3 threads) > > Checking transaction log consistency. > > Creating 100000 objects... > > Transaction log OK. > > > > ============================================================= > > TEST 4 RANDOM FILE BACKED SERIALIZATION 50-52 THREADS > > ============================================================= > > > > RunPrevaylerQueryTest property is set to NO. > > This test will be skipped (see properties file). > > > > Prevayler TransactionLog Directory: TransactionTest > > > > Prevayler Journal Serializer: org.prevayler.foundation.serialization.JavaSerializer > > > > ========= Running Transaction Test (3 rounds). Subject: Prevayler... > > Creating 100000 objects... > > Creating 100000 objects... > > Each round will take approx. 20 seconds to run... > > > > Memory used: 113995776 > > Disk space used: 7261389 > > Seconds ellapsed: 20.109 > > --------- Round Result: 1564.77 operations/second (50 threads) > > > > Memory used: 123265024 > > Disk space used: 7261389 > > Seconds ellapsed: 20.059 > > --------- Round Result: 1549.18 operations/second (51 threads) > > > > Memory used: 124002304 > > Disk space used: 7261389 > > Seconds ellapsed: 20.059 > > --------- Round Result: 1566.93 operations/second (52 threads) > > > > ----------- BEST ROUND: 1566.93 operations/second (52 threads) > > Checking transaction log consistency. > > Creating 100000 objects... > > Transaction log OK. |