Question

I just tested the H2 datastore (with Datanucleus 2.x)

The performance is VERY slow. 1/3 of Postgres and 1/10 of MySQL (aprox.)

I was very pleased by the "specs" but i cannot see them in "real usage". http://www.h2database.com/html/performance.html

Is there any performance tuning that i might be missing?

EDIT:

H2 is not SLOW. Is one of the fastest RDBMS i have tested to date!

I need help explaining WHY i need to CONNECT to the database using the WEB MANAGER (H2 console) to get the fantastic speed of this DB engine... I accidentally tested my app when CONNECTED through the H2 WEB console "et voilá", problem solved.

Why?

Was it helpful?

Solution

By default, H2 closes the database when the last connection is closed. If your application closes the only connection after each operation, the database is opened and closed a lot, which is quite slow.

There are multiple ways to solve this problem:

  • use a connection pool, or
  • keep a 'sentinel' connection open for as long as the application runs, or
  • use delayed database closing by appending ;DB_CLOSE_DELAY=10 to the database URL

OTHER TIPS

Sounds like you have a host lookup problem; 5 seconds is a typical DNS timeout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top