开发者

JVM memory management in Unix/Linux

开发者 https://www.devze.com 2023-01-25 12:43 出处:网络
Hi I experience a strange phenomena. I have a Java application that queries DB by means of Hibernate ORM.

Hi I experience a strange phenomena.

I have a Java application that queries DB by means of Hibernate ORM.

In HP-UX sgx842 B.11.11 U 9000/800 888281448 unlimited-user license after I start the server and make a few queries of a few thousand records the heap size settles at 800MB.

In Linux sglx481.amk.st.com 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST 2006 x86_64 x86_64 x86_64 GN开发者_StackOverflow中文版U/Linux the memory explodes until the maximum JVM memory (set by -Xmx option). However, the system doesn't slow down and can still perform querying data. There is no OutOfMemoryError exception. There's no apparent drop in performance visually, although I haven't used a tool.

There is no problem in Windows either.

In hibernate I don't use annotations but open and close session and tranasction manually.

sessionFactory = new Configuration().configure(CONFIG_FILE_LOCATION).buildSessionFactory();
session = sessionFactory.getSessionFactory().openSession();


session.beginTransaction();
...
session.close();


This is what a garbage collected run time looks like. Memory is fast, but garbage collection slows things down, so there's just no reason not to use all available memory, and avoid garbage collecting anything unless you actually need to.

0

精彩评论

暂无评论...
验证码 换一张
取 消