Hi,
We have a mongo replica setup(1 Primary + 3 Secondary + 1 arbiter) for one of our online self serving application. During recent days, we could see around 100K mongo queries (Sample Query pasted below) everyday were made additionally along with usual application triggered mongo queries. And we suspect it as the root cause for the overall slow performance of Primary Mongo DB during recent times.
Number of Mongo Queries which takes more than 100ms everyday is more than 1 Million
It sounds like there are some resource pressure (memory, CPU, etc.) in your deployment. I would suggest perusing through these links to confirm that your deployment follows the recommended production settings:
There are also tools that comes by default with your MongoDB installation that could help investigate performance issues, such as mongotop and mongostat.
Since you mentioned that slow queries are your primary issue, I would recommend mtools. In particular, mloginfo and mplotqueries.
Tue Jun 14 03:04:11 [conn1027720] insert \.system.indexes keyUpdates:0 locks(micros) w:79 242ms
Could you please suggest what could be the reason behind the trigger of the above queries ?
The query above describes an insert operation into the system.indexes collection. In MongoDB 2.2, documents are inserted into this collection using the db.collection.ensureIndex() command. However as I understand it, this is only one slow query among many that you are seeing in the logs (100k out of 1 million slow queries), so it may be unlikely that this single query is the reason for the overall slow performance. I would suggest to analyze your logs using mloginfo --queries and mplotqueries for more details.
Mongo Version installed is 2.2.1
Please note that MongoDB 2.2 was released in August 2012 and reached its end-of-life on February 2014. The latest MongoDB version is currently 3.2.7. I would recommend you to explore your upgrade options, since there are major improvements in many areas of MongoDB that were made in the past four years.
Best regards,
Kevin