Database Reference
In-Depth Information
Figure 2-7. Shard pattern
Shard Concepts and Methods
Before visiting the shard patterns, let's analyze the various aspects of shard design. Some important
concepts are explained here:
Decision rules . Logic that determines without a doubt which database
contains the interesting record(s). For example, if Country = US, then
connect to SQL Azure Database #1 . Rules can be static (hardcoded in C#, for
example) or dynamic (stored in XML configuration files). Static rules tend to
limit the ability to grow the shard easily, because adding a new database is
likely to change the rules. Dynamic rules, on the other hand, may require the
creation of a rule engine. Not all shard libraries use decision rules.
Round-robin. A method that changes the database endpoint for every new
connection (or other condition) in a consistent manner. For example, when
accessing a group of five databases in a round-robin manner, the first
connection is made to database 1, the second to database 2, and so on.
Then, the sixth connection is made to database 1 again, and so forth. Round-
robin methods avoid the creation of decision engines and attempt to spread
the data and the load evenly across all databases involved in a shard.
Horizontal partition. A collection of tables with similar schemas that
represent an entire dataset when concatenated. For example, sales records
can be split by country, where each country is stored in a separate table. You
can create a horizontal partition by applying decision rules or using a round-
robin method. When using a round-robin method, no logic helps identify
which database contains the record of interest; so all databases must be
searched.
Vertical partition. A table schema split across multiple databases. As a
result, a single record's columns are stored on multiple databases. Although
this is considered a valid technique, vertical partitioning isn't explored in
this topic.
Search WWH ::




Custom Search