-->
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.  [ 4 posts ] 
Author Message
 Post subject: Overhead of multiple session factories...
PostPosted: Wed Nov 02, 2005 8:50 am 
Newbie

Joined: Thu Jan 20, 2005 12:21 pm
Posts: 9
Hi,


It is known that session factories are 'heavy' objects in terms of the overhead required for their initialization.

Nevertheless, there might be reasons to have multiple session factories within one application, such as:
  • Requiring access to different databases from within the same application
  • Requiring different naming conventions or other configuration options
    for different parts of the application
  • Managabiliity: the application (which uses Hibernate) uses third party
    products that also use hibernate. Having one session factory per
    product makes it easy to manage the persistence configurations for
    these products independently. Here independent session factories are
    possible since the products communicate with each other exclusively
    through APIs and not through the database.

Now my question is. What is the overhead of having multiple session factories instead of one in terms of processing (CPU) and memory?

Cheers
Erik[/list]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 9:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
dependent on how many mappings and data you have.

but is it just like an extra sessionfactory, so if you create 10 sessionfactories from the same configuration you will use 10 times more memory to keep those instances in the air.

multiple sessionfactories does not affect CPU time except the extra time you need to create them.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 12:38 pm 
Newbie

Joined: Thu Jan 20, 2005 12:21 pm
Posts: 9
So in other words, if I have for example 20 classes of which the first 10 are mapped independently of the other 10, then having two session factories has a negligible overhead compared to only one?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 12:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well as a i said you will use twice the memory, but that is at least constant.

_________________
Max
Don't forget to rate


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