Mongo Write Client connection

214 Views Asked by At

What does the MongoDB_ActiveClientsWriting_ metric in mongostat refer to?

If I am performing multiple writes from an application on the same connection - does it get audited as a single Active Client?
In that case - does a connection indicate a thread - a single funnel of write?
Or does Mongo have inherent worker threads to fork off parallel writes on a connection.

If so,what is the metric/configuration that flags the active threads writing at a time.
We are using Mongo 4.x.x

1

There are 1 best solutions below

0
On

It is stats from the locker - how many active connections keep write lock at the time of reporting. https://docs.mongodb.com/manual/reference/command/serverStatus/#serverstatus.globalLock.activeClients reads:

globalLock.activeClients.total

The total number of internal client connections to the database including system threads as well as queued readers and writers. This metric will be higher than the total of activeClients.readers and activeClients.writers due to the inclusion of system threads.

globalLock.activeClients.readers

The number of the active client connections performing read operations.

globalLock.activeClients.writers

The number of active client connections performing write operations.

The metric itself is calculated in https://github.com/mongodb/mongo/blob/3a508dcd9755cc5012288068ce88afb9117ac8b8/src/mongo/db/stats/lock_server_status_section.cpp#L55