JVM CPU and memory consumption by H2 server

203 views
Skip to first unread message

mansour n

unread,
Oct 17, 2017, 11:58:02 AM10/17/17
to H2 Database
Hi,

We are testing performance on a Java application which uses a H2 database in server mode (in a dedicated JVM) and we have noticed an important CPU and Heap memory consumption by the H2 JVM even though there is very little or no JDBC activity
For information we monitor H2 JVM with Java Mission Control (via JMX).
In the attached exemple, we have some activity before 14:30 and after 14:30 we have 1.5 req / min (average)

1) Heap Memory
As we can see in screenshot, heap memory is constantly increasing even when we have Major GC, the heap size doesn't return to the initial level. 
The JVM Heap max size is frequently increased from 35Mo to 55Mo.

2) Heap CPU
CPU Heap consumption fluctuates always between 10-20% with some pics over 40% 

We have big constraints in terms of RAM and CPU consumption since we are on an embedded system with a small hardware configuration (1 core and 256 Mo RAM).
Can you tell us how can we optimize this ? limit H2 cache size ? limit H2 background activity
If you have another tools to monitor h2 performance we are also interested for example to get JDBC stats, Cache utilization

JVM args    :  -Xms32M -Xmx64M
JDBC URL : jdbc.h2.url=jdbc:h2:tcp://localhost:1521/k;DB_CLOSE_ON_EXIT=FALSE;TRACE_LEVEL_FILE=4;INIT=CREATE SCHEMA IF NOT EXISTS XXX\\;SET SCHEMA XXX;
H2 version : 1.4.196

Thanks
Mansour
h2_heap_memory_cpu_consumption.png
gc.log.0.current

Noel Grandin

unread,
Oct 18, 2017, 10:06:17 AM10/18/17
to h2-da...@googlegroups.com, mansour n
you'd have to do a deeper investigation to see what exactly is happening and where the memory is going to.


You could try using the older engin (MV_STORE=false) which might have less background activity because it doesn't need
background compaction.
Reply all
Reply to author
Forward
0 new messages