Why is H2 1.1.117 performance inferior on Mac OS X?
When running the same query (SELECT with a couple of INNER JOINs) on a table with 400k rows, it takes almost 30 times longer on Mac OS X, than on Linux or Windows 7. Granted, the hardware configurations are different, but not different enough to warrant such a big difference. I was able to reproduce the performance issue on several computers running Mac OS X 10.6. The weird thing is, that I got the expected performance once after killing H2 in the middle of the long query execution, and letting H2 repair the database on next startup. However, I wasn't able to consistently reproduce this.
What I noticed on Mac OS X was that a couple of seconds after submitting the query, both CPU and disk usage falls to almost zero, and only goes back up right before returning the query results.
The test computers had the following versions of Java installed:- Mac OS X: Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) Java HotSpot(TM) 64-Bit Server VM 开发者_运维技巧(build 19.1-b02-334, mixed mode)
- Linux: Java(TM) SE Runtime Environment (build 1.6.0_20-b02), Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode))
- Windows: Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
All computers were running H2 1.1.117. While I know that this version is quite old, I would prefer to stick with it for now, but I need to sort out this apparently platform-specific performance issue. I have googled around for bug reports, but haven't found anything related.
It's very unlikely this is related to the operating system.
If both CPU and disk usage are zero, I suggest to get a full thread dump (jps -l
, and then jstack -l <pid>
) to find out what the process is doing.
Did you run ANALYZE? On newer versions of H2 (1.3.x) this is no longer required by the way.
If this isn't the problem, I suggest to have a look at the Database Performance Tuning documentation. I know, a lot of it is generic, but it might still help. If this still doesn't solve the problem, please see Application Profiling and update the question with the results you found.
精彩评论