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: Shared hosting scenario: best practices?
PostPosted: Tue Jun 21, 2005 4:19 am 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Hi all,

We have Hibernate 2.1.8, mySQL using c3p0 on a modern machine (4Gb Ram, 3,2Mhz, RAID 1) and we expect to deploy at least 20 identical webapps on a single server. I was wondering what the best practice are regarding this kind of scenario.

I'm not an expert on connection pooling, but I would imagine that it is inefficient to have 20 connection pools fighting for resources. What is the ideal configuration and how should I configure c3p0. Are there any code level optimizations I can make?

With regards to caching: is it necessary to have the cache prefix configured or just an option. What kind of caching configuration would be optimal.

How can I optimize deployment of updates? Centralizing the libraries in the shared directories seems impossible because each webapp has its own configuration for hibernate, c3p0, log4j, etc or are there tricks to be performed here?

How can we evaluate the server load and take action before things start going wrong (without actually upgrading to Hibernate 3, we're not quite ready for that).

Any suggestions are welcome.

Kind regards,

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 2:29 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
Hi.

With respect to c3p0, if your webapps are running not only on the same server, but in the same JVM, it will probably be more manageable to have them share a single Connection pool. If I've done my job right (a big if, but you can tell me what's broken if I haven't), one pool should be able to scale well. Increasing the number of c3p0's helper threads on a single pool should work about as well as having multple pools around. (The number of helper threads is a configurable parameter; see c3p0's docs.) Please do use the latest c3p0-0.9.0-pre release, as there have been recent scalability improvements.

Probably the easiest way to configure a shared c3p0 DataSource would be to bind it to a jndi namespace and have your app/hibernate look it up from there. If you use hibernate's built-in c3p0 config, you'll end up with a pool for each app, I think.

If the apps are running in different VMs, there's not much point to any of this. Though the "same" DataSource might be looked up via a name service, each VM will require separate thread, Connection, and other resources to manage the pool. You might as well just configure separate c3p0 pools for each app in any convenient way.

hope this helps,
Steve (c3p0 guy)


Top
 Profile  
 
 Post subject: does this go for every app having a different datasource
PostPosted: Sat Jun 25, 2005 6:14 am 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Sorry, I'm not too knowledgeable on this subject, but a single connection pool for multiple webapps also works when every app has its own database/datasource?

Kind regards,

Marc


Top
 Profile  
 
 Post subject: does this go for every app having a different datasource
PostPosted: Sat Jun 25, 2005 6:16 am 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Sorry, I'm not too knowledgeable on this subject, but a single connection pool for multiple webapps also works when every app has its own database/datasource?

Kind regards,

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 26, 2005 3:41 pm 
Newbie

Joined: Mon May 30, 2005 10:26 am
Posts: 13
I would say definitely not. Connection pooling is about sharing/re-using connections to the same database.


Top
 Profile  
 
 Post subject: Re: does this go for every app having a different datasource
PostPosted: Sun Jun 26, 2005 4:15 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
mschipperheyn wrote:
Sorry, I'm not too knowledgeable on this subject, but a single connection pool for multiple webapps also works when every app has its own database/datasource?
Kind regards,
Marc

I am not sure it is a good idea, but it must work. You can execute SQL command to change shema and authorization for current session.


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.