H2 Server Performance

124 views
Skip to first unread message

Olaf Brenn

unread,
Oct 30, 2024, 11:18:41 AM10/30/24
to H2 Database
Hi there, we are using a local H2 database within an java app using hibernate. In local mode all is running fast (0,003 s per query). When we switch to server mode on an remote server the access get very very slow (lokal: few seconds, server: several minutes up to 1,5 hours). This behavour is very strange. Is there any specific setting we have to make to speed up the server mode (memory, caching, index)? We are using the regular windows service mode. As we found no solution in the net we assume that the problem must be very simple.
Is there any idea? 

Olaf       

Andrei Tokar

unread,
Oct 30, 2024, 8:34:03 PM10/30/24
to H2 Database
Hi Olaf,
Please look at H2 docs "Performance" page. It shows that 10-15 times slowdown is kind of expected, when you switch from local to a remote server mode.
On the hand, 1000 times slowdown does not look right. It might be you network performance (unexpected routing via proxy etc.) or it could be H2 misconfiguration, because. 3000 queries/sec does not sound like much, assuming your queries are simple few rows selects with proper indexing.
As far as memory goes, you can try to increase heap size as much as you can just to see if it makes a difference.
In any case it is impossible to give any meaningful advice without knowing more details.
You may also try to run some provided benchmark, mentioned on that page to see whether your results will be in the same ballpark.

Andrei

Olaf Brenn

unread,
Nov 6, 2024, 5:30:33 PM11/6/24
to H2 Database
Thanks, we found out, that using and increasing batch mode is improving the issue.
Reply all
Reply to author
Forward
0 new messages