I have a web application developed with Laravel PHP Framework. I use MongoDB as database.
Sometimes MongoDB does not accept connections until I restart the server and my application does not work because of that. When I look at MongoDB logs, I always see serverstatus was very slow
message before that happens. When mongodb is lost, php creates MongoDB\Driver\Exception\ConnectionTimeoutException
.
10 minutes after MongoDB is lost, I check the application. It loads the static pages normally. Cannot serve pages that requires database requests. So, server is responding in time. But, MongoDB still does not accept connections.
Why do I get this problem and why does MongoDB stop working?
This happens because RAM is not sufficient. Increase it and problem will be solved.