Closed zenghur closed 6 years ago
Hi @zenghur
Do you have more information? Like what authentication mechanism you're using, mongo version, etc.
Even though the "global session" (really just the first connection) has been authenticated, subsequent connections still need to authenticate because they're new connections mongo doesn't know about. Your tight loop is creating more work than a single connection can perform, so the driver is opening more connections, thus requiring the authentication to be completed for each.
Dom
Recently, there was a weired behavior in our prod environment. A single find one query cost to much time. I already built index on this field. I use this snippet of code to reproduce the same behavior.
Then, I find there are high probabilities that socketLogin() would auth even though globalSession has been authenticated. This action costs too much time. Why this copy session cant remember the existing auth info?