H2 Inmemory not able to load 7lc records and giving heapspace issues

57 views
Skip to first unread message

Tapan Aggarwal

unread,
Jul 25, 2021, 12:15:42 AM7/25/21
to H2 Database
Hi ,

I have an Inventory application created in Quarkus framework with AWS RDS Db. I configured H2 inmemory db with the application for faster performance. on my local inventory table in RDS Db was having 1 lc records so h2 inmemory while startup of application was building this table in memory successfully. I did load tests , http tests with wrk tool, JMH tools with success.But when I took this to production server where I am having 6lc records in inventory on RDS. H2 inmemory is not able to load inventory, build H2 in mem . 

If I use MVStore=false in my connection url for in memory h2 db, I am able to build the db in mem successfully, but soon starts giving heapspace and thread blocking issues. Also if I run it on File server mode it loads quickly but I want to run it in memory.

This is my connection url : quarkus.datasource.jdbc.url=jdbc:h2:mem:INVDB;MODE=MYSQL;IGNORECASE=TRUE;CACHE_SIZE=6368709;MV_STORE=false;RETENTION_TIME=1000

please suggest how to load in memory this database successfully with no heap space issues.

With regards,
Tapan Aggarwal

Noel Grandin

unread,
Jul 25, 2021, 2:29:15 AM7/25/21
to H2 Database
try using nioMemFS to store the data on the native heap

Tapan Aggarwal

unread,
Jul 31, 2021, 2:44:50 PM7/31/21
to H2 Database
Thanks Noel we are testing using these configuration in UAT and than move to prod once get good results.

One more thing we are facing is high heap size of 10 GB due to H2.  There is high H2 Connection leak  detection count we are recieving and Connection pool active count if set higher to 800, the application does not release this Connection pool to 0 even minutes after high load test ends and available H2 count is 0 all through than. We have to restart the instance to make them 0 . We are using Quarkus framework, Please see attached graphs.
These are the rest of h2 jdbc properties in quarkus application properties file :
quarkus.datasource.jdbc.min-size=400
quarkus.datasource.jdbc.max-size=800
quarkus.datasource.jdbc.detect-statement-leaks=true
quarkus.datasource.jdbc.pooling-enabled=true
   
Kindly advice.
With regards,
Tapan Aggarwal
Screenshot from 2021-08-01 00-04-21.png
Screenshot from 2021-08-01 00-05-00.png
Screenshot from 2021-08-01 00-05-20.png
Reply all
Reply to author
Forward
0 new messages