search

Home  >  Q&A  >  body text

为什么 mongodb 的插入这么不稳定

我初始化了一个1000w的分片集合,再对这个集合插入10w的数据,在插入的过程中速度特别不稳定,甚至1条数据插入执行了超过1s 请问这是什么原因呢?

某草草某草草2792 days ago645

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-05-02 09:21:01

    Forgot to create the shard index key? Check it.

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:21:01

    It is impossible to determine what is going on without giving the configuration of the sharded collection. This is usually due to improper configuration of the shard key.
    Please refer to the documentation for the choice of shard key: https://docs.mongodb.com/v3.0/tutorial/choose-a-shard-key/
    In addition, there is a slides on LinkedIn that is also very good: http://www .slideshare.net/daumdna/mongodb-scaling-write-performance

    reply
    0
  • Cancelreply