Performance issues using H2 DB in native mode with heavy data load in the database

I am working with a Java application using H2 Database in native mode. My application consumes 150 mb of heap memory.

Problem: measures When I load an H2 database with 2 MB of data, access to the database is fast and the heap memory size is 160 MB.

But when I load the H2 database with 30 MB of data (file size h2 db = 30 mb). Then access to the database from my application is very slow. the reason is because my application heap size has grown dramatically to 300 MB, which degrades performance. I have confirmed using JConsole.

So, I understand that Java is developed from the H2 database, and since I use the H2 database in native mode, the heap size of the H2 database is added to my application, which breaks the application.

The problem is that the size of the H2 database is growing, the performance of my application is getting worse.

How to solve the problem?

I established the connection as

 rurl = "jdbc:h2:file:/" + getDBPath() + dbname + ";CACHE_SIZE=" + (1024 * 1024) + ";PAGE_SIZE=512";

to increase H2 cache.

+5
source share
1 answer

In most cases, performance issues are not actually related to cache size or page size. To analyze performance issues, see the H2 Documentation, especially:

1024 * 1024, H2 1 . , 1 , JVM ( java -Xmx2048m ). ( 16 ).

, , . , , . , - - .

+5

All Articles