Is it necessary to verify we are on a replicaset for every OplogHandle?

This command gets executed thousands of times a minute for my team’s deployment, according to our Datadog metrics it gets executed between 150-200k times per hour during our peak usage.

And MongoDB’s metrics similarly point to most slow queries in our entire cluster being this ismaster command.

Just curious if we really need to verify (by asking the database) that we are connected to the master every time we create a new OplogHandle?

1 Like

I’ve seen a lot of Meteor apps in production and I’ve never seen this operation anywhere high in the long-running queries.

Also, it runs once, at the application start – that’d mean, you start your application 150k times within an hour…? That’s suspicious, to say the least.

And finally, this command is extremely fast – it takes 0.005s on one of our clusters. Have you tried running it manually and checking the performance?

We have 60 containers running our application with 4-600 users during peak. Our p50 is usually under 5ms, but once you get into the p90 and above it slows down tremendously.
This screenshot is for an hour.

1 Like

That’s an awful lot of queries. Have you checked whether it correlates with containers starting or stopping? Or maybe the database CPU? I’ve checked a few apps right now, ranging from a few to tens of containers and we can’t see anything like it (we’re using Atlas and I’m checking the Profiler tab).