5

I wanted to integrate MongoDB in my applicaion. I have tested using Apache Banchmarking tool and produce 1,00,000 incoming request with 1000 concurrency level. After some test of insertion of records in mongodb, I can figure out that it is inserting around 1000 rec/sec. But it is not sufficient for my applicaion. Can anybody suggest that what is the best way to improve perofmance, so that I can acheive the goal of 2000 rec/sec.

My code is:

private static MongoOptions mo = new MongoOptions();
mo.connectionsPerHost = 20;
mo.threadsAllowedToBlockForConnectionMultiplier = 100; 
private static Mongo m = new Mongo("127.0.0.1",mo);     
private static DB db = m.getDB("mydb");
private static DBCollection coll = db.getCollection("mycoll");
DBObject dbObj  = (DBObject) JSON.parse(msg);
db.requestStart();      
coll.insert(dbObj);     
dbObj.removeField("_id");       
dbObj.put("val", "-10");
coll.insert(dbObj);
db.requestDone();
3
  • 1
    See if this helps : stackoverflow.com/questions/6783212/… Commented Jul 28, 2011 at 10:34
  • Are you sure you're running into a mongo imposed bottleneck? 1000 inserts per second is extremely slow. I can easily hit 20,000+ inserts per second on my local dev machine alone. Make sure you're benchmarking correctly. On a healthy production server the insert throughput should be much, much better. Commented Jul 29, 2011 at 11:40
  • I am using tomcate server. Is there any configuration of MongoOption? Can you tell me how many connection per host you are giving? Commented Jul 29, 2011 at 12:01

1 Answer 1

2

Having 1000 clients (which is what I assume you mean by concurrency level 1000) hitting the DB at one time sounds high to me. If it is running on a 1-2 core system your box is probably spending a lot of time switching between the different processes. Is the DB and benchmarking tool running on the same box? That will increase the amount of time it spends process switching also.

You could try putting the client on one multi core box and the DB on another.

Or try running fewer simulated clients maybe 10-20.

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

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.