Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Hibernate Shards Programmatic Sharding
PostPosted: Thu Nov 24, 2011 10:49 am 
Newbie

Joined: Thu Nov 24, 2011 10:37 am
Posts: 2
I am doing Research and Development on Hibernate Multi tenancy implementation. One requirement in our system is to have a capability for dynamic sharding whenever a new tenant is created. I have read about virtual shards but i believe its still not the solution we are looking for.

We expect no downtime in our SaaS application and each tenant will have its corresponding database and shard. We are planning to create the database on the fly whenever a new tenant is created. However, we are not sure on how to add the new shard into the ShardedSessionFactory that was initially built using Hibernate Shards. One option we thought is to rebuild the ShardedSessionFactory and hot-swap it to the existing one. But then again, this might not be safe during concurrent user access.

What is the most elegant solution for this kind of implementation? How do we handle this scenario using Hibernate Shards?

Thanks in advance


Top
 Profile  
 
 Post subject: Re: Hibernate Shards Programmatic Sharding
PostPosted: Thu Nov 24, 2011 12:34 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2296
Location: Third rock from the Sun
Hi,
I don't think this was in the scope the Hibernate Shards project. Did you look into the multitenancy support in Hibernate 4 ?

I think it would be possible to use Shards in a hot-swap configuration, adding a bit of clever code around your Session and SessionFactory. If you could create a custom SessionFactory which wraps the standard one, you could have it track open/close of session, and on a "swap" it sould start serving new session from the new one, while on the last close on the old one you could know when it's safe to actually close the old SessionFactory.

Keep in mind 2nd level cache won't be in synch: if that's not acceptable, disable it or use a clustered implementation so that they can sync up with other SessionFactory instances.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate Shards Programmatic Sharding
PostPosted: Thu Nov 24, 2011 6:11 pm 
Newbie

Joined: Thu Nov 24, 2011 6:09 pm
Posts: 1
Although not part of the Hibernate Shards project - ScaleBase fully supports Hibernate Shards, and can give you exactly the features you need. Try it out at http://www.scalebase.com


Top
 Profile  
 
 Post subject: Re: Hibernate Shards Programmatic Sharding
PostPosted: Thu Nov 24, 2011 9:58 pm 
Newbie

Joined: Thu Nov 24, 2011 10:37 am
Posts: 2
Hi Sanne,

Thanks for the info. Anyway, do you know if Hibernate 4 supports the programmatic sharding requirement? Also, I am wondering if there are documentations on how to setup multi tenancy in hibernate 4.

Thanks again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.