-->
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: Hibernate distribution (failover, load-balancing, grid)?
PostPosted: Sun Mar 20, 2011 4:11 am 
Beginner
Beginner

Joined: Tue May 11, 2004 12:20 am
Posts: 33
Hi,
We're developing an application that would need failover and load-balancing.
We're new to this, and were wondering what Hibernate offers there?
We hear the buzzwords "2nd-level cache" and "Shards", but aren't sure how they fit together.

If we were coding from scratch (without Hibernate), we'd want "a grid, plus failover, plus a bit of data-sharing".
E.g. say we run a shop with 2 branches (New-York and Los-Angeles).
We'd purchase 4 servers as following:

1) Two NY servers (holding identical replicates of NY inventory data), with failover/load-balancing between them

2) Two LA servers (ditto)

3) 90% of the tasks don't require data-sharing between cities (a NY order is handled from NY inventory - no need to contact the LA branch).
But on rare occasions you'd need the other city's data (e.g. if you're missing an item in inventory you may order it from the other branch; you'll also want a monthly report summing up expenses from both NY+LA).

Is any of this feasible with Hibernate / Shards?
If so, what would be the high-level architecture (just a few lines to get us in the right direction)?
Thanks :)


Top
 Profile  
 
 Post subject: Re: Hibernate distribution (failover, load-balancing, grid)?
PostPosted: Sun Mar 20, 2011 8:56 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
Hibernate offers many integrations with "other stuff" and grid technologies, but from what you described you don't need much special things.
Remember Hibernate is primarily the interface between your app and a database, so in case of clustering/failover, each application talks to the database directly and there's not much you need to do (compared to self-coded JDBC code, as you might still want to configure your database with failover and such, but this doesn't affect Hibernate) besides taking care of one catch: if you use a second-level cache, one node might be caching something which the other node changed.
So you either a) avoid enabling second level cache b) use a clustered second level cache which talks to other instances to invalidate cache entries on all involved nodes (like Infinispan).

Nothing prevents you from having two Hibernate configurations pointing to the two different databases, one in LA and one in NY. Keeping the caches in synch between the two might be more costly than the benefits it brings (no idea not knowing the details, just expecting), as you suggest that each node only occasionally talks to the other, you might want to disable caching the remote data.
Working with two databases involves XA transactions, and because one is remote I'd recommend to use a proper Transaction Manager. The JBossTM is able to optimize resources pretty cleverly, so I think it should be able to avoid cross-country network roundtrips to the remote DB when operating on the local DB only, you might have to configure multiple datasources and use the proper one according to application logic.

To push on the new buzzwords, Infinispan is technically a Grid, at JBossWorld in May they will show a demo about multi-datacenter clustering, so eventually you might use all possible second level cache configuration even cross-region, depending on your kind of workloads I can't predict which one would be better.
There's also the option to shard the entities, have a look at the recent webinar from Steve Ebersole: http://www.jboss.org/webinars

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


Top
 Profile  
 
 Post subject: Re: Hibernate distribution (failover, load-balancing, grid)?
PostPosted: Sun Mar 20, 2011 9:09 am 
Beginner
Beginner

Joined: Tue May 11, 2004 12:20 am
Posts: 33
Thanks so much for this excellent reply :)


Top
 Profile  
 
 Post subject: Re: Hibernate distribution (failover, load-balancing, grid)?
PostPosted: Sun Mar 20, 2011 9:19 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
was a pleasure, maybe we'll meet here:
http://www.redhat.com/summit/sessions/jboss.html#83
http://www.redhat.com/summit/sessions/best-of.html#66

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


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.