3

I am trying to use serverStatus command to evaluate the performance of my MongoDB 3.4 server.

> var status = db.serverStatus()
> status.connections
{ "current" : 20, "available" : 51180, "totalCreated" : 67 }

-> How do I analyze the output of this command to evaluate the performance of MongoDB server ? -> There are too many connections available which are not being used. Does this mean that it is affecting the performance ?

The doc seems pretty straightforward. So, any insights on this would be very helpful.

oblivion
  • 5,928
  • 3
  • 34
  • 55

1 Answers1

3

There are too many connections available which are not being used. Does this mean that it is affecting the performance ?

On the contrary, it would affect performance if nearly all connections were used. If a client attempt to connect with no connection available, it will be pooled and have to wait for an available connection. It might also fail, depending on your connection settings (after the configured timeout for instance).

Unused connections are just slots available. It might use some memory overhead, but few to no resource are taken for them.

With lots of connections available and few used, your mongdb server can serve a lot more clients. Of course, you should also monitor the resources usage by your machine, that would be much more meaningful.

See https://docs.mongodb.com/manual/reference/connection-string/ and https://docs.mongodb.com/manual/applications/drivers/ for more details

You should also check that your system is able to handle this amount of connection (max system file descriptors, see for example this question : mongodb : Increasing max connections in mongodb). Otherwise this setting will just be ignored, your connections will be capped by your system's limit.

How do I analyze the output of this command to evaluate the performance of MongoDB server ?

The only thing that could also be analyzed here is totalCreated, which can serve as historical data. You should compare it with the time since mongoDB has been running to extract some meaningful information, of course.

Pac0
  • 21,465
  • 8
  • 65
  • 74