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();