How to automatically kill slow MongoDB queries?

前端 未结 4 1140
执笔经年
执笔经年 2021-01-13 04:54

Is there a way that I can protect my app against slow queries in MongoDB? My application has tons of possibilities of filters and I\'m monitoring all these queries but at th

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-13 05:44

    I guess there is currently no support for killing query by passing time argument. Though in your development side, you can set profiler level to 2. It will log every query that has been issued. From there you can see which queries take how much time. I know its not what you exactly wanted but it helps in getting the insight of what all queries are fat and then in your app logic you can have some way to gracefully handle such cases where those queries might originate. I usually go by this approach and it helps.

提交回复
热议问题