Aiming for high performance on single server

Besides running on one server there are also some other concerns with this deployment.

  1. Using the date field (which is monotomically increaseing) is not the best for a shard key. See here. This can lead to a “hot” shard because the data isn’t actually balanced as time goes on, the older date range will not be used as much as time moves forward. This can cause a small amount of the shards to handle most of the queries thus making your sharding kind of useless.
  2. You have 11 different shards but does your query use the shard key as a prefix? If not you will get scatter gather queries across all 11 shards. Instead of direct and specific queries going to the correct shard only.
  3. Standalone shards are not recommended because if one of the nodes goes down that portion of the data isn’t available since it’s distributed across the shards.
  4. Finally Sharding isn’t a “magic” solution that give instant performance as said before your queries have to be optimized so they are routed by the mongos correctly.
3 Likes