-->
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.  [ 6 posts ] 
Author Message
 Post subject: 2nd level cache and copy on write into session possible?
PostPosted: Tue Nov 16, 2004 6:54 pm 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
I'm are considering using a very large 2nd level cache for a large app with many users. Since there are so many sessions and a large part of the DB would be in the 2nd level cache, it is a pity that each object used in a session is always copied. It would cause us to hit physical memory limit (30GB RAM).

Now I'm wondering: is it not possible for the session cache to use objects directly from the 2nd level cache and only create copies on write? That would be great for scaleability w.r.t. number of user sessions.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 16, 2004 6:57 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No, not out-of-the-box. This would also imply that your complete second-level cache is fully transactional and not give you much performance benefit. Session size certainly is an issue, but are you really sure that this affects you? Do you have benchmarks that show that this is a problem?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 16, 2004 7:05 pm 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
christian wrote:
No, not out-of-the-box. This would also imply that your complete second-level cache is fully transactional and not give you much performance benefit. Session size certainly is an issue, but are you really sure that this affects you? Do you have benchmarks that show that this is a problem?


No, we're just at the start of a large project, so no experience/benchmarks yet.

We do have the amount of RAM to hold the whole active part of the DB in memory, and reads outnumber writes by a factor of 10 (estimated) or more. So a large cache should be of great benefit. However, individual user sessions may use a significant amount of total RAM (say 10%), so already 10 parallel user sessions would double the amount of used RAM simply by creating copies of objects that are not likely to be modified. That is quite a waste; it would be very nice if it could be avoided. Not only because of RAM usage, but also because of the strain it puts on the garbage collector.

The alternative would be to use one session for the small editing stuff, and use other session with flush/clear (or even bypass hibernate alltogether) for producing large lists of objects. Do you think the latter is the only way?

Thanks for any insight.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 16, 2004 7:14 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The Hibernate Session is _not_ the same as a user session.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 16, 2004 7:40 pm 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
christian wrote:
The Hibernate Session is _not_ the same as a user session.


I know, I was talking about 10 parallel hibernate sessions :). Typically we'll have 3000 or more parallel user sessions. With 10 real transactions parallel in progress, the amount of memory waste due to all the copying for (mostly) read-only objects is quite large.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 16, 2004 7:42 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Thats nothing, people have hundreds of parallel Hibernate sessions.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.