-->
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: Some elementry Shards questions
PostPosted: Fri Jun 22, 2007 4:01 pm 
Newbie

Joined: Sun Jan 11, 2004 10:36 am
Posts: 5
Hi,
Nice work on shards. It looks very cool. I have some really basic questions about it, since I'm trying to figure out if it is a solution for a problem I have (and to understand where shards would be called for for future work). I'm going to have to apologize in advance for any rambling. It's been a long day so far.

1. Is it possible to get a tarball of the example code?

2. What requirements does shards have on the database configuration, re partitioning? Does the database need to be partitioned using the database mechanism (such as MySQL 5.1, or Postgresql 8.x )? Is it possible to simply have multiple DB schemas (mapping one schema per shard), assuming that the schemas are identical (say for mysql < 5.1 or postgresql < 8.0).

Some notes in the docs.
1. section 2.2, the createSessionFactory. the 3 lines for the "shardConfigs.add(new ....("shard0.hibernate.cfg.xml) (and shard1, shard2) doesn't match the two config/map filenames (weather0.hibernate.cfg.xml and weather1.hibernate.cfg.xml)

This is where I also noticed that the connection url, username and password were all identical for the two listed weather0 and weather1 configs

Also, in the section talking about how these configs have to be identical (except for url/user/pass), it has some discussion on how changes are ignored. What happens if one of these files is different at load time (which one does it use, or does it throw an exception?[url][/url]

Thats it off the top of my head. If I find more, I'll post it here.

Tx for releasing a very cool product!

Randy


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 24, 2007 12:48 am 
Contributor
Contributor

Joined: Fri Feb 11, 2005 8:15 pm
Posts: 31
Hi Randy, thanks for posting. Let me try and answer your questions.

1) The example code from the docs was written purely for the docs so at the moment there isn't a tar I can provide you with. We're hoping to put together more detailed examples in the future that can be downloaded and easily run, but for now you'll just have to make do with the code that's in the docs.

2) Shards is a partitioning solution that, like Hibernate itself, sits above your databases. And Shards, like Hibernate, doesn't really know anything about how you're using in-database partitioning. So whether you're using a database that supports in-database partitioning (like MySQL 5.1) or not, and whether you're making use of that feature or not, from Hibernate's perspective and from Shards' perspective it's just another database with tables. You can absolutely have multiple DB schemas residing on the same database server and you can configure each of those schemas as a separate shard. You can do this whether you're using a database that supports horizontal partitioning or not. Remember, Shards is for doing horizontal partitioning across multiple databases. MySQL 5.1 supports horizontal partitioning within a single database.

About the docs:
In Chapter 1 section 2.2 it's a documentation bug. This was fixed a few months ago but we haven't put together a new build that contains the fix.

As for the configs needing to be identical, we won't throw an exception if something is different, we'll just ignore the differences and take the values that are present in the "prototype" configuration (take a look at http://www.hibernate.org/hib_docs/shard ... uration-sf and then look at line 2 in the createSessionFactory() example).

Please let me know if any of this doesn't make sense or if you have additional questions.

Thanks,
Max


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 8:58 am 
Newbie

Joined: Sun Jan 11, 2004 10:36 am
Posts: 5
Tx Max. This helps a LOT. It makes sense that shards is a portable partitioning scheme, with the same goals as hibernate. I'm going to actually setup a test environement to play with shards this morning.

One question I still have is it possible to have multiple shards in the same database instance, or would that be more appropriate to use hibernate filters? I'm going to try to test case it.

Anything that I do that seems useful, I'll post it to this forum.

Tx again!
Randy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 12:24 am 
Contributor
Contributor

Joined: Fri Feb 11, 2005 8:15 pm
Posts: 31
Hi Randy,

I'm glad you found the explanation useful. You can certainly use Shards against a single database instance - as long as each SessionFactory can only "see" data that is associated with a single shard you'll be fine. You can definitely do some partitioning with filters, but that's really just logical partitioning, not physical partitioning, and logical partitioning isn't going to give you the scalability boost that physical partitioning gives you.

Hope that helps,
Max


Top
 Profile  
 
 Post subject: Sharding example code
PostPosted: Thu Jun 28, 2007 8:39 am 
Newbie

Joined: Sun Jan 11, 2004 10:36 am
Posts: 5
Hi Max,
I'm feeling much more comfortable with sharding now. Very nice implementation! I've got a decent prototype, that after I do a bit of rework, I can release to you if you are interested. I need to clean up some references to the company I'm using this for, but my boss said I can release it. It's a nice app, that hopefully will show most of the aspects of sharding, including extending the ShardSelectionStratgey to do login based shard determination, etc.

Feel free to contact me via email if you are interested (or not!).

Tx again for a very useful tool. The way I explain sharding to people is that shards is to db partitioning as hibernate is to sql.

Randy


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 4:56 pm 
Contributor
Contributor

Joined: Fri Feb 11, 2005 8:15 pm
Posts: 31
Hi Randy,

I'd love to see what you've got. Once it's been properly sanitized perhaps you could just upload it as an open-source project on Google Code?

Thanks,
Max


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.