Partitioning data
As we saw in Chapter 1, Getting Started with DocumentDB, DocumentDB has limits on its resources. A maximum of 10 GB per collection and maximum requests units per collection is set to 2,500 per second. To be able to go above these limits and reach a truly high scale, we need to partition our data by using sharding. For more information on the sharding pattern, please visit https://msdn.microsoft.com/en-us/library/dn589797.aspx.
Collections in DocumentDB are both logical and physical containers. Triggers and stored procedures do not go beyond these boundaries when it comes to transactions.
This section will discuss how to use sharding. The best sharding techniques are based on how our data is formatted and accessed. Basically, there are two sharding techniques:
Hash partitioning
Range partitioning
Using hash partitioning
When we use hash partitioning, partitions are assigned based on the outcome of a hash function. This will allow us to distribute all requests and data evenly across...