-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate shards input on sharding strategy etc.
PostPosted: Mon Jul 07, 2008 7:06 am 
Newbie

Joined: Mon Mar 10, 2008 4:25 am
Posts: 4
Hello, I am currently considering Hibernate Shards for horizontal partitioning since we are already using Hibernate throughout our system. I have a few questions / need for some input regarding choice of strategies.

I am thinking about a rather straightforward way of sharding the data based on ID, lets say shard00 consists of entries with IDs = 1 - 15 000 000, shard 01 with IDs 15 000 001 - 30 000 000 etc, using mysql and configureing each db / schema this way and using native ID generation.

My question is then how to solve the shard selection strategy in a good way that allows for easy scaling... I guess one way would be to say that each shard has 15 000 000 entries and then keeping some current max ID to determine on what shard the next entry should be stored by taking currentMaxID / entriesPerShard... But how should this be done in a robust manner? Should we use a support table for keeping track of the highest ID? (sort of like table HI-LO does)? Or is this not a good way of solving this? This way I guess the only thing that has to be changed when expanding with more shards is the configuration file for the new shard and the loading of the session factory. Or?

And I also assume that resolution strategy would then be straightforward aswell since you can determine the shard based on the ID...

Sorry for the fuzzy questions. Hope to get some initial pointers on this from one of you guys that have some hands on experience with shards:)

Cheers,
Aleksander M. Stensby


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 08, 2008 8:45 am 
Newbie

Joined: Mon Mar 10, 2008 4:25 am
Posts: 4
been thinking more on this and since there are no replies I'll share my (possibly) silly thoughts..

Generating native id's should be no problem, but as far as I can see, my problem lies in the ShardSelectionStrategy... How can I make my strategy aware of the shards when the ID of a new object is not yet known at the stage of shard-selection? My thoughts in the previous post was to use a support table (such as the hibernate_unique_key table) residing on the control shard, and then simply keep track of the current highest ID.. but then I would need access to the control session in the ShardSelectionStrategy, right? And I don't really see how I can supply the control session to the strategy since the strategy is defined and supplied to the strategy factory before the actual shard session factory is created...

I might missing something really important and possibly simple here, so please correct me if I'm off here...

Hoping for some good feedback on this:)

Cheers,
Aleksander


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