Our test tool creates n threads and execute m iteration inside each thread. We calculate min, avg and max operation time. So that we see from time to time mongo executes request extremely slow - up to few seconds. Also each time first operation are slowest, we even exclude it intentionally from statistics and still difference between avg and max is huge. Is it normal? Can I eliminate those slow operations? Why mongo executes some of requests so extremely slow?
Below results for single operations mode and mix mode when we run simultaneously tests for insert/get/remove/update. In mix mode thread=1 means we created 4 threads one for each type of test
We used default value - 100 connections per host
Source
public void storeMt(MyTestObject myTestObject) {
mongoTemplate.insert(myTestObject );
}
public MyTestObject getMt(long id) {
MyTestObject result = mongoTemplate.findById(id, MyTestObject.class);
return result;
}
@Document
public class MyTestObject implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long id;
//class contains 20+ fields
.......
I see few reasons why this may be happening.
I am sure if you do this, you will find out the exact reason why it is slowing down.
Cheers!