1

Assume I have a mongodb instance on a remote server (1 core cpu and 8G memory). When I send a simple query db.table.find({_id:ObjectId('xxx')}).limit(1).explain()to the instance, I got the result show that query cost 10ms. So can I come to a conclusion that "my mongodb server can only handle 100 simple query per second"?

1
  • How did you time that, from the web server? Then it would include the time taken to pass and process the data to the web service as well as any network latency depending where they are in relation to each other. Commented Mar 25, 2019 at 10:26

3 Answers 3

2

"So can I come to a conclusion that "my mongodb server can only handle 100 simple query per second""

Its not tht like that 1 query takes 10ms then 100 query will take 1sec db.table.find({_id:ObjectId('xxx')}).limit(1) will not lock your table So if your 100 client request this with 100 connections all will return in 10ms Concurrency Depends upon locks and connection limits

If a query locking collection for read and write for 10 sec then all query after that will wait for lock to cleared

MongoDb Can Handle multiple Request

db.runCommand( { serverStatus: 1 } ) will return current status of mongo there is object in

"connections" : {
    "current" : <num>,
    "available" : <num>,
    "totalCreated" : <num>,
    "active" : <num>
}

https://docs.mongodb.com/manual/reference/command/serverStatus/#connections

https://docs.mongodb.com/manual/reference/configuration-options/#net.maxIncomingConnections

https://docs.mongodb.com/manual/faq/concurrency/

These will give more clarity around connections and its limits

Sign up to request clarification or add additional context in comments.

Comments

1

You should know, your mongodb server can handle many parallel queries.

Comments

-1

your assumption is incorrect, cuz u are ignoring the fact that mongodb supports concurrency

Source

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.