MongoDB: Sharding on single machine. Does it make sense?

后端 未结 5 1317
说谎
说谎 2020-12-30 06:56

created a collection in MongoDB consisting of 11446615 documents.

Each document has the following form:

{ 
 \"_id\" : ObjectId(\"4e03dec7c3c365f57482         


        
5条回答
  •  抹茶落季
    2020-12-30 07:28

    This doesn't have to be a mongo question, it's a general operating system question. There are three possible bottlenecks for your database use.

    1. network (i.e. you're on a gigabit line, you're using most of it at peak times, but your database isn't really loaded down)
    2. CPU (your CPU is near 100% but disk and network are barely ticking over)
    3. disk

    In the case of network, rewrite your network protocol if possible, otherwise shard to other machines. In the case of CPU, if you're 100% on a few cores but others are free, sharding on the same machine will improve performance. If disk is fully utilized add more disks and shard across them -- way cheaper than adding more machines.

提交回复
热议问题