According to docker container statistics, my mongo database consumes constantly between 250 and 350% cpu. That\'s pretty impressive since it\'s a single core system :P
T
The first and more important thing that you need to do is check your kind of queries, for example, in my case I had the same problem and when I checked my logs tail -f /var/log/mongodb/mongod.log
(You can configure this logs in /etc/mongod.conf
) I only saw the simple queries like db.brands.find({"field":"value"}) but I checked my indexes in "brands" collections and this field on queries was not indexed (db.brands.getIndexes()
). The only thing that I did is index this field db.brands.ensureIndex({name:1},{unique:true})
. Of course make sure if your field is unique because in this example I put as a unique. After that my CPU changed from 100% to 20%.
So I am not saying that is your problem but could be, check your queries before doing some bigger things.