Mongo database error in resource allocation pthread_create failed: errno:11 Resource temporarily unavailable


maximum number of open files 64000
maximum number of processes 64000

It is taking 50seconds to complete query.

How to allocate more sources?
Mostly because of memory utilization. Observed mongodb log and found that the same time at which pthread_create failed, other processes were consuming memory so no room for mongodb.