The purpose of this library is to provide an open-source project of a possible implementation of a Shard: a Horizontal Partition Shard (HPS). A HPS allows your code to query and modify data against multiple databases (SQL Server and SQL Azure) without knowing precisely which database contains the actual data.
With this library you may be able to achieve the following objectives:
- Increase system performance by adding another database to the shard
- Increase scalability by adding multiple databases to the shard
- Spread the load of queries over multiple databases
- Reduce the impact of running a database in the cloud
You should note however that your schema design may impact the ability to use this library. Since the shard is a HPS, a table is split horizontally and as such the primary of each table is not unique throughout the shard. As a result, an additional key, the database GUID,
is required to fully resolve the location of a record in the shard. the database GUID is also called a breadcrumb, and it is calculated on the fly and added automatically to the resultsets when calling on the shard methods.
- ExecuteShardQuery should be used when reading data from the shard. It returns the breadcrumb (GUID).
- ExecuteShardNonQuery should be used when updating data in the shard. It expects the breadcrumb back.
- ExecuteParallelRoundRobinLoad performs a massive insert of records in the shard, in a round robing manner.
- UseParallel is true by default and spreads the shard execute methods over multiple threads using the Parallel Task Library (PTL)
- UseCache is true by default and loads a cache (Enterprise Library Cache) of results to avoid further roundtrips
- UseSlidingWindow controls the behavior of the cache in a way that slides the expiration of its content as the data is being read