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.
精彩评论