Your “waiting for cache” issue is almost certainly because your query threads are getting stuck doing cache housekeeping work. When MongoDB’s cache hits 95% in any area, your actual query threads start doing eviction work instead of running queries.
you should be able to get more insight by running this:
db.serverStatus().wiredTiger.cache[“pages evicted by application threads”]
^^ if you see it go up then its most likely that
if that is the issue you can bump this up to fix it:
storage:
wiredTiger:
engineConfig:
configString: “eviction=(threads_min=8,threads_max=16)”
that should be safe to do because you’ll just be adding 7 more background threads (assuming you’re on the default) that will compete for cpu cycles (assuming here that you are not cpu bound then it wont be noticable)
either way you should confirm first with that command before updating the conf