mongo global query lock

112 views
Skip to first unread message

Stone Fang

unread,
Jun 27, 2017, 9:12:46 AM6/27/17
to mongodb-user
have a 3 nodes replicat set environment.1 is for voting

4cpu,8G memory

there are a document with 0.1 billion documents

db.desc{
name:
id:
desc:
}
have a index on{id:1,name:1}

the query is db.desc.find({id:xxx,name:xxx})

this query can work on the index.but sometime,when there are 3k/sec query.

there are some low query,spend lots of time to get the read lock.

locks: {
            Global: {
                acquireCount: {
                    r: NumberLong(2)
                },
                acquireWaitCount: {
                    r: NumberLong(1)
                },
                timeAcquiringMicros: {
                    r: NumberLong(195740)
                }
            },

CPU and memory are normal,so don't think there are any blocks.
and seems that memory is enough to load index into ram.

anyone know cause about this?

Stone Fang

unread,
Jun 27, 2017, 9:56:59 AM6/27/17
to mongodb-user

read lock,and it is a global lock

Kevin Adistambha

unread,
Jun 30, 2017, 1:25:42 AM6/30/17
to mongodb-user

Hi

Having a global read lock might mean that there is an operation requiring an exclusive instance-wide lock, such as creating a new database, dropping databases, etc. Is this disruptive to your operation in any way? What about the 95th percentile of the queries, do they all exhibit this waiting?

If this is disruptive to your deployment, it’s helpful to provide more information:

  • Is the 3-node replica set running on their own separate hardware, or are they all running inside a single physical machine (e.g. virtualized, dockerized, etc.)?
  • What is your MongoDB version, your OS version, and the filesystem used?
  • What is your storage engine
  • Is this waiting for lock a recurring issue, or intermittent?
  • What is the output of db.serverCmdLineOpts()
  • For the affected collection, what is the output of db.collection.stats()
  • Have you set up your deployment by following the recommendations outlined in the Production Notes

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages