Hi,
Could you get a heap histogram and post it ("jstack -l" to get the process
id, then "jmap -histo <pid>" to get the heap histogram)?
I guess it's because of the many tables and views; H2 currently keeps the
whole metadata info in memory (unlike other databases such as Oracle or
PostgreSQL). I suggest to use a lower number of tables and views, for
example 100 instead of 2000. I wonder, did you manually create so many
tables and views? Or is those generated automatically?
Regards,
Thomas
On Thu, Nov 21, 2013 at 2:32 AM, Min Huang <[email protected]> wrote:
> I got several report from application users of out of memory exception
> when connecting to a H2 server. When trying to reproduce, I used jconsole
> to connect to the H2 server and check what's going on.
>
> I found when I connect to the H2 server and load a database the first
> time, H2 server start consuming a lot of memory. Before loading any
> database, the H2 server only consume 3M memory. After using Squirrel SQL
> client connecting to the H2 and load the 250M file database, H2 server
> consume about 1G memory. What could be the reason this happen?
>
> H2 server start command: java -Xmx2g -Xms16m -XX:PermSize=16m
> -XX:MaxPermSize=256m -cp "h2-1.3.173.jar;%H2DRIVERS%;%CLASSPATH%"
> org.h2.tools.Server -tcp -tcpPort 9097 -tcpAllowOthers -baseDir C:\temp\h2db
>
> My connection string: jdbc:h2:tcp://localhost:9097/db1;DB_CLOSE_DELAY=-1
> ------------------------------
> Additional information: We have quite some tables(1200+) in the database,
> and 800+ views which union or join on these tables. Will this be the cause
> of this problem? Could there be any solutions that reduce the memory
> consumption when loading such database?
>
>
> The stackoverflow thread at:
>
> http://stackoverflow.com/questions/20107314/h2-server-consume-1g-memory-to-load-a-250m-file-based-database
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.