Skip to main content

How do you avoid shard hotspots?

Senior MongoDB
Quick Answer Avoid shard hotspots by choosing a shard key with even write distribution. Don't use monotonically increasing keys (timestamps, ObjectId) as shard keys - all new writes go to the last chunk on one shard. Solutions: use hashed shard key (distributes writes randomly), use compound shard key combining a high-write field with a hash component, or pre-split chunks before loading data.

Answer

Avoid monotonically increasing keys and choose high-cardinality shard keys or hashed keys for even write distribution.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice