First Shard for SQL Azure and SQL Server
- by Herve Roggero
That's it!!!!! It's ready to go and be tested, abused and improved! It requires .NET 4.0 and uses some cool technologies, like caching (the new System.Runtime.Caching) and the Task Parallel Library (System.Threading.Tasks).
With this library you can:
Define a shard of 1, 2 or 100 SQL databases (a mix of SQL Server and SQL Azure)
Read from the shard in parallel or sequentially, and cache resultsets
Update, Delete a record from the shard
Insert records quickly in the shard with a round-robin load
Reset the cache
You can download the source code and a sample application here: http://enzosqlshard.codeplex.com/
Note about the breadcrumbs: I had to add a connection GUID in order for the library to know which database a record came from. The GUID is currently calculated on the fly in the library using some of the parameters of the connection string. The GUID is also dynamically added to the result set so the client can pass it back to the library. I am curious to get your feedback on this approach.
** Correction from my previous post: this is a library for a Horizontal Partition Shard (HPS): tables are split across databases horizontally. So in essence, the tables need to have the same schema across the databases.