Hi everyone,I have a very odd problem. I run the exact same, extraordinarily simple sqlite4java-282 program on four different machines, and the time to complete varies from ~60ms to ~1 second.- laptop running Mac OS X 10.8- desktop running 32-bit Ubuntu 10.4- server running 64-bit Ubuntu 12.10- server running 64-bit RHELYou can see the very short source code of the main program (and try it out! using this GitHub repo: https://github.com/dhalperi/sqlite-test) here: https://github.com/dhalperi/sqlite-test/blob/master/src/test/sqlite/Main.java#L64All it does is time opening a database, a few CREATE TABLE statements, and then closing. There are a few intermediate print statements that time the execution to ensure it's not just opening and closing that cause the issue. You can see sample Mac and Ubuntu outputs below.On Mac and RHEL it takes around 100 ms to run. On both Ubuntu machines it takes around a second(!!). I'm thoroughly stumped as to why this could be happening. In particular, the same JRE (Oracle Java 7u21) is on all 4 machines. The same JNILIB is used on the 64-bit ubuntu and the 64-bit RHEL. All the machines are completely idle. The filesystem is the same on the Ubuntu and RHEL servers (ext4). The disk speeds are comparable, seek times are short. Any other ideas?Thanks! (output below)DanMac:Apr 21, 2013 12:12:12 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: instantiated [/var/folders/m_/qltd_g_13qd1v5tvr4l6q2rc0000gn/T/temp5456065157583186690db]
Apr 21, 2013 12:12:12 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite4java-osx-10.4 from system path
Apr 21, 2013 12:12:12 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite 3.7.10, wrapper 0.2
Apr 21, 2013 12:12:12 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: opened
108 ms 99 us
112 ms 351 us
Apr 21, 2013 12:12:12 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: connection closed
116 ms 687 usUbuntu serverApr 21, 2013 12:13:41 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: instantiated [/tmp/temp4525485152507069348db]
Apr 21, 2013 12:13:41 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite4java-linux-i386 from system path
Apr 21, 2013 12:13:41 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite 3.7.10, wrapper 0.2
Apr 21, 2013 12:13:41 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: opened
502 ms 934 us 662 ns
705 ms 487 us 365 ns
Apr 21, 2013 12:13:42 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: connection closed
916 ms 177 us 662 ns
RHEL server--Apr 21, 2013 12:20:27 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: instantiated [/tmp/temp2920981342866812331db]
Apr 21, 2013 12:20:27 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite4java-linux-amd64 from system path
Apr 21, 2013 12:20:27 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite 3.7.10, wrapper 0.2
Apr 21, 2013 12:20:27 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: opened
84 ms 599 us 551 ns
92 ms 728 us 272 ns
Apr 21, 2013 12:20:27 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: connection closed
You received this message because you are subscribed to the Google Groups "sqlite4java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlite4java...@googlegroups.com.
To post to this group, send email to sqlit...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlite4java?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Hello Dan,
Thanks – that’s an interesting question. Out of curiosity, I ran your test on Windows 7 x64, the result is about 100ms.
Given your observation, one can think that the reason is exceptionally long time it takes to commit a transaction. Why is that so on Ubuntu, I’ve no idea. Sqlite3 does fsync, as far as I know, maybe Ubuntu kernel is compiled with some options that make this operation long. You can try playing with sqlite’s PRAGMAs to influence how commit is made.
I see you have shell scripts for doing the same actions with sqlite3 directly – what times do you see there? (Could you try those scripts with exactly the same sqlite3 version?)
The version of sqlite3 compiled in sqlite4java is a bit outdated, we need to update it soon. Maybe there was a related issue fixed recently.
Kind regards,
Igor
Sounds potentially like our old friend, fsync. Perhaps check the mount and compile options of ext4 on each?