I am using MongoDB for a large ecommerce operation with a couple million products. We cache the categories and some product data in mongo for fast access.
We are still in development but we have a behavior we’d like to investigate. Overnight our server is idle. When we leave for the night everything is fast and caching is working splendidly. When we come in in the morning after the server is idle overnight it is extremely slow. But after some time it speeds up agin.
Looking at memory I see mongoDB bump up (as I expected) during this time as it becomes more active. I am sort of assuming that Mongo is moving data down to disk during idle time and back up to memory when it is accessed the next morning.
If that’s the case then this problem will likley go away on production where the pages will be accessed quite frequently.
Does anyone (any mongo guru out there) have a take on my hypothesis? I’m investigating other causes certainly (DB access, CF inits etc) but this seems most likely to me.
Mongo relays memory management to the OS (memory-mapped files mechanism). So yes, if some memory region is not accessed for some time, system flushes changes to disk (if any) and frees it.
Yes, this shouldn’t happen in production when there’s activity all the time.