MongoDB Connection Issues
Make sure you have right UNIX ulimit Settings.You can see also: https://docs.mongodb.org/manual/reference/ulimit/
Use top command to check if the performance bottleneck is CPU overload.Check the mongodb log file if there is any slow query,and you can use MTools to analyse it.Then you need optimize the slow query.
Use free command to check if not enough physical memory is available.If MongoDB has too many connections,you need to check Stack settings.every connection is a thread,need a Stack,Stack settings usually is too large by default in Linux:
shell&gt; ulimit -a | grep stack
You can see the real used Stack size,like this:
shell&gt; cat /proc/$(pidof mongod)/limits | grep stack | awk -F 'size' '{print int($NF)/1024}'
The total mem consumed by connections is so large,I suggest you set it smaller,such as 1024:
shell&gt; ulimit -s 1024