-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Hello,
the daily usage of my H2 instance (custom Java application with H2 library) can be divided into four phases:
- About 3-6 hours in the morning, crunch new data and CRUD them in the DB.
- Then, most of the day, nothing happens, only occasional DB query (usually a few per day)
- During the night, close the database with SHUTDOWN COMPACT to avoid DB bloat (it gets to 20x the former size in a few days otherwise), then reopen it.
- Don't do anything until the phase 1 starts again.
Up to 2.1.214, this worked mostly well, with H2 taking just negligible CPU when not queried. But when I updated to 2.2.224, suddenly after phase 1 is finished, H2 continues to use a lot of resources in phase 2 - about 20-30% of the CPU available (8 cores), disk, RAM. Mostly the H2 thread and GC (see the screenshot below). After the DB is shut down and reopened, it does not consume much resources anymore. That means c. 12-16 hours of several cores utilized to the max, with a lot of disk writes and memory consumed.
The virtual machine has 8 cores and 16 GB of RAM. The DB is opened with the following parameters:
WRITE_DELAY=10000;DB_CLOSE_ON_EXIT=FALSE;CACHE_SIZE=2097152;MAX_COMPACT_TIME=60
The database size is typically around 30-40GB before daily compacting (5GB afterwards) and it has 10 tables with just a few columns (but a lot of records) with some hash indexes.
When experimenting with different versions, I discovered that this started with 2.2.222. I didn't find anything in the changelog regarding this so I suppose it is a side effect of some other change?
Does anyone else experience this? Could this be solved by some parameter tweaking? I understand that this is difficult to troubleshoot, but I don't even know where I would start about creating a test case. I'll try to experiment further, but it takes time.



