Search code examples
ruby-on-railsperformancemongodbmongoidsharding

Does Mongoid present any difficulties to scaling?


I am busy designing a web application that will hopefully become very large, with many users. I have chosen MongoDB as a data store, one of the main reasons being its ability to scale horizontally as the user base grows.

Does anyone have any experience using Mongoid to interact with a highly distributed MongoDB handling a lot of traffic? Is there any reason to be concerned about the performance?


Solution

  • So pre 2.0 Mongodb suffered from a global lock, that caused serious problems with scaling. This has been changed in 2.0 for a Lock with Dynamic yield

    The mongod process uses a modified reader/writer lock with dynamic yielding on page faults and long operations. Any number of concurrent read operations are allowed, but a write operation can block all other operations.

    I found some basic performance testing of the Global Lock vs Lock with Yield.

    There is no issue in using Mongoid to access a sharded Mongodb setup. Mongoid just needs to be configured to access the nodes of the shard.