-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate + Ehcache using too much RAM for caching?
PostPosted: Mon Jul 18, 2011 9:43 am 
Newbie

Joined: Mon Jul 18, 2011 9:36 am
Posts: 2
Hi,

I have a Hibernate application that has an Entity with 3 properties (two strings, one integer) and an Id. When I persist and cache an object of this entity and call cache.calculateInMemorySize(), I'm told by Ehcache that this object is using more than 1kbs in Ram. Caching 100k (100,000) objects uses up more than 100mbs according to cache.calculateInMemorySize().

Is this an expected behaviour with Hibernate + Ehcache?
Is the amount of RAM been used justifiable?

An application that demonstrates the situation is posted at the link below, any insight will be much appreciated.

http://forums.terracotta.org/forums/posts/list/5687.page

Hibernate: 3.4.0.GA
Ehcache: 2.4.3

Thanks,
Yinka.


Last edited by yerinle on Mon Jul 18, 2011 11:56 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Hibernate + Ehcache using too much RAM for caching?
PostPosted: Mon Jul 18, 2011 10:15 am 
Newbie

Joined: Mon Jul 18, 2011 9:36 am
Posts: 2
Putting the same entity directly in the cache gives the numbers below

1 Entity - 508bytes
100K Entities - 49mb

Which is about half of what is used when hibernate handles the caching.

Please can someone that understands explain the rational for the extra memory consumption.

Thanks,
Yinka.


Top
 Profile  
 
 Post subject: Re: Hibernate + Ehcache using too much RAM for caching?
PostPosted: Tue Jan 10, 2012 8:42 am 
Newbie

Joined: Tue Jan 10, 2012 8:40 am
Posts: 5
Hello Everyone, I am adding the objects into ehcache with session.createQuery.list() using hibernate, and have the cache size of 50000(maxelementsInMemory) and 2,00,000 records in DB (postgreSQL),
it occupies 65 MB of Memory(In Hibernate statistics), so, please give me any option to optimize the memory occupied by it ??

How to add the detached objects into ehcache ???

Waiting for your reply thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.