Here are some stats from OSX
1.5GHz PowerBook 5400 rpm h/d (internal), [EMAIL PROTECTED] full HFS+ file system
FYI, notably some tests can vary widely in speed. For instance, they can speed considerably ( >50% faster than some prior runs) if the test is run again immediately. There were some other variations (not always speedups) on the order of 10% on some tests. Here are some interesting "rws" and "rwd" results distilled from three varied runs:
04. Testing growing file using RandomAccessFile "rws": Writes per second: 9132.42 writes/s
04. Testing growing file using RandomAccessFile "rws": Writes per second: 8703.22 writes/s
04. Testing growing file using RandomAccessFile "rws": Writes per second: 12853.47 writes/s
05. Testing preallocated file using RandomAccessFile "rws": Failed with exception: java.io.FileNotFoundException: (File exists)
05. Testing preallocated file using RandomAccessFile "rws": Failed with exception: java.io.FileNotFoundException: (File exists)
05. Testing preallocated file using RandomAccessFile "rws": Failed with exception: java.io.FileNotFoundException: (File exists)
06. Testing growing file using RandomAccessFile "rwd": Writes per second: 6693.44 writes/s
06. Testing growing file using RandomAccessFile "rwd": Writes per second: 11198.208 writes/s
06. Testing growing file using RandomAccessFile "rwd": Writes per second: 14836.795 writes/s
07. Testing preallocated file using RandomAccessFile "rwd": Writes per second: 9523.81 writes/s
07. Testing preallocated file using RandomAccessFile "rwd": Writes per second: 10438.413 writes/s
07. Testing preallocated file using RandomAccessFile "rwd": Writes per second: 19801.98 writes/s
12. Testing growing file using direct buffer + FileChannel "rws": Writes per second: 9523.81 writes/s
12. Testing growing file using direct buffer + FileChannel "rws": Writes per second: 10626.993 writes/s
12. Testing growing file using direct buffer + FileChannel "rws": Writes per second: 14727.541 writes/s
13. Testing preallocated file using direct buffer + FileChannel "rws": Failed with exception: java.io.FileNotFoundException: (File exists)
13. Testing preallocated file using direct buffer + FileChannel "rws": Failed with exception: java.io.FileNotFoundException: (File exists)
13. Testing preallocated file using direct buffer + FileChannel "rws": Failed with exception: java.io.FileNotFoundException: (File exists)
14. Testing growing file using direct buffer + FileChannel "rwd": Writes per second: 6035.003 writes/s
14. Testing growing file using direct buffer + FileChannel "rwd": Writes per second: 9950.249 writes/s
14. Testing growing file using direct buffer + FileChannel "rwd": Writes per second: 8424.6 writes/s
15. Testing preallocated file using direct buffer + FileChannel "rwd": Writes per second: 8568.98 writes/s
15. Testing preallocated file using direct buffer + FileChannel "rwd": Writes per second: 10559.662 writes/s
15. Testing preallocated file using direct buffer + FileChannel "rwd": Writes per second: 13333.333 writes/s
NB: "rws" fails with an unrecoverable error in tests #5 and #13, so I vote -1 on using "preallocated+rws" as a derby write strategy (at least for now until the "preallocated+rws" file open failure root cause is identified (e.g., whether this exception is valid or somehow in violation of a specification).
The first run was the first ever run of the program on the system. The second was the third run after a reboot (i.e., reboot, run, run, do plenty of other work, then result run), and the final run was immediately following the second run (i.e., a fast run). I'm not sure which of these is most representative, but the variance is at least interesting.
The full results from the second (middling) run above are appended.
= Joe =
--------------------------------------------- 1. System info: ---------------------------------------------
OS Platform: Mac OS X/ppc/10.3.5
Java spec: Java Platform API Specification version 1.4 from Sun Microsystems Inc.
Java VM: Java HotSpot(TM) Client VM version 1.4.2-38 from "Apple Computer, Inc."
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home
Test file: /Users/occam/dev/java/derby/test.bin
Test file exists, deleting...
---------------------------------------------------------------------
2. Testing growing file using RandomAccessFile "rw" + .getFD().sync()
---------------------------------------------------------------------
Chunk size: 4228 bytes
Count: 10000
Total time: 10527 ms
Writes per second: 949.938 writes/s
Time per chunk: 1.053 ms
Write bandwidth: 3.0MB/s------------------------------------------------------------------------ ---
3. Testing preallocated file using RandomAccessFile "rw" + .getFD().sync()
------------------------------------------------------------------------ ---
Chunk size: 4228 bytes
Count: 10000
Total time: 10088 ms
Writes per second: 991.277 writes/s
Time per chunk: 1.009 ms
Write bandwidth: 3.0MB/s
---------------------------------------------------------------------
4. Testing growing file using RandomAccessFile "rws"
---------------------------------------------------------------------
Chunk size: 4228 bytes
Count: 10000
Total time: 1149 ms
Writes per second: 8703.22 writes/s
Time per chunk: 0.115 ms
Write bandwidth: 35.0MB/s--------------------------------------------------------------------- 5. Testing preallocated file using RandomAccessFile "rws" ---------------------------------------------------------------------
Failed with exception: java.io.FileNotFoundException: /Users/occam/dev/java/derby/test.bin (File exists)
--------------------------------------------------------------------- 6. Testing growing file using RandomAccessFile "rwd" --------------------------------------------------------------------- Chunk size: 4228 bytes Count: 10000 Total time: 893 ms Writes per second: 11198.208 writes/s Time per chunk: 0.089 ms Write bandwidth: 45.0MB/s
---------------------------------------------------------------------
7. Testing preallocated file using RandomAccessFile "rwd"
---------------------------------------------------------------------
Chunk size: 4228 bytes
Count: 10000
Total time: 958 ms
Writes per second: 10438.413 writes/s
Time per chunk: 0.096 ms
Write bandwidth: 42.0MB/s------------------------------------------------------------------------ ------
8. Testing growing file using direct buffer + FileChannel "rw" + force(true)
------------------------------------------------------------------------ ------
Chunk size: 4228 bytes
Count: 10000
Total time: 10032 ms
Writes per second: 996.81 writes/s
Time per chunk: 1.003 ms
Write bandwidth: 4.0MB/s
------------------------------------------------------------------------ -----------
9. Testing preallocated file using direct buffer + FileChannel "rw" + force(true)
------------------------------------------------------------------------ -----------
Chunk size: 4228 bytes
Count: 10000
Total time: 10062 ms
Writes per second: 993.838 writes/s
Time per chunk: 1.006 ms
Write bandwidth: 4.0MB/s
------------------------------------------------------------------------ ------
10. Testing growing file using direct buffer + FileChannel "rw" + force(false)
------------------------------------------------------------------------ ------
Chunk size: 4228 bytes
Count: 10000
Total time: 10241 ms
Writes per second: 976.467 writes/s
Time per chunk: 1.024 ms
Write bandwidth: 3.0MB/s
------------------------------------------------------------------------ ------
11. Testing preallocated file using direct buffer + FileChannel "rw" + force(false)
------------------------------------------------------------------------ ------
Chunk size: 4228 bytes
Count: 10000
Total time: 10226 ms
Writes per second: 977.899 writes/s
Time per chunk: 1.023 ms
Write bandwidth: 3.0MB/s
------------------------------------------------------------------------ ------
12. Testing growing file using direct buffer + FileChannel "rws"
------------------------------------------------------------------------ ------
Chunk size: 4228 bytes
Count: 10000
Total time: 941 ms
Writes per second: 10626.993 writes/s
Time per chunk: 0.094 ms
Write bandwidth: 42.0MB/s
------------------------------------------------------------------------ ------
13. Testing preallocated file using direct buffer + FileChannel "rws"
------------------------------------------------------------------------ ------
Failed with exception: java.io.FileNotFoundException: /Users/occam/dev/java/derby/test.bin (File exists)
------------------------------------------------------------------------ ------
14. Testing growing file using direct buffer + FileChannel "rwd"
------------------------------------------------------------------------ ------
Chunk size: 4228 bytes
Count: 10000
Total time: 1005 ms
Writes per second: 9950.249 writes/s
Time per chunk: 0.101 ms
Write bandwidth: 40.0MB/s
------------------------------------------------------------------------ ------
15. Testing preallocated file using direct buffer + FileChannel "rwd"
------------------------------------------------------------------------ ------
Chunk size: 4228 bytes
Count: 10000
Total time: 947 ms
Writes per second: 10559.662 writes/s
Time per chunk: 0.095 ms
Write bandwidth: 42.0MB/s
