MongoDB: Queries running twice slow on NEW server compared to OLD server

I transferred current/old running DB into a new standalone server for MongoDB. To do this, I performed the following:

  1. Took dump of data from OLD server
  2. Restored data from the generated dump into NEW server
  3. Configured the server for authentication

Issue:
I noticed that after performing the above, few queries on the NEW server were running slow almost twice the time compared to their performance on the OLD server.

Configurations:
The configurations of both the servers are same however the NEW server has 32 GB RAM while the OLD server had 28GB RAM. OLD server had other applications and servers running as well. While the NEW server is a dedicated server only for this DB.

CPU consumption is similar however RAM is heavily occupied in the OLD server while it is comparatively less occupied on NEW server.

Therefore, NEW server is better equipped in hardware and RAM consumption. Also NEW server is standalone dedicated to only this DB.

Question:
Why could my NEW server even though it is standalone be slow compared to OLD one? How can I correct this?

1 Like

The first thing is to check the explain from the queries to see if indexes are use correctly.

2 Likes

Hi @Temp_ORary and welcome in the MongoDB Community :muscle: !

If the data and indexes are absolutely identical, then the explain plans should be exactly identical on the old & new server. One difference though is that the old server is running in prod while the new one isn’t - based on what I understood here.
So the old cluster is hot while the new is cold. Meaning that the working set isn’t already loaded in RAM in the new server while it is in the old server as it’s constantly freeing some RAM and pulling more fresh documents from disk into the RAM.
If this is not happening as well on the new server, then maybe it’s slow just because it’s cold and it needs to load more documents in RAM.
Once it’s done, I would expect the new node to be a tiny bit faster than the old one - given than the hard drives are at least identical or better.

Cheers,
Maxime.

4 Likes