[SERVER-907] mongos performance optimization Created: 07/Feb/10  Updated: 12/Jul/16  Resolved: 24/Mar/10

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 1.3.5

Type: Improvement Priority: Minor - P4
Reporter: Ilya Martynov Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File mongo.diff     File mongos.callgrind    
Participants:

 Description   

When testing sharding support (the test is described in http://jira.mongodb.org/browse/SHARDING-77) I noticed from the top that most of time is being spend in mongos instead of mongod what seems non-intuitive. On the first glance for simple queries mongos should doing next to nothing compared to mongod. I made a profile using google's perftool and it looks like a lot of time is being spend copying data what seems to be wrong as normally this type of application if correctly written should be spending time in IO (the profile in callgrind format is attached, it can be viewed with kcachegrind). I've looked into the code and it seems that there is a lot of waste coming from copying temporary objects again and again. Particularly use of ServerAndQuery objects inside ShardStrategy::queryOp() is very non-optimal. Even with simple refactoring by changing some constructors to pass data by const references instead of value (see the attached patch) I could speedup my test on 30% but there is a lot of room for improvement if ServerAndQuery copying eliminated completely.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 24/Mar/10 ]

was already merged

Comment by Ilya Martynov [ 08/Feb/10 ]

Done. See git://github.com/IlyaM/mongo.git

Comment by Ilya Martynov [ 08/Feb/10 ]

Eliot,

I'll give it a go, I have never used git besides cloning existing repositories so give me some time to learn the ropes

Comment by Eliot Horowitz (Inactive) [ 07/Feb/10 ]

Yeah - we have done almost no optimization yet.
The patch looks good.
Would you be up for forking on github and then commiting that patch?

Generated at Thu Feb 08 02:55:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.