increased performance with repetition
I've been running a few tests using the Couchbase 1.8 server and comparing it with a memcached server, using both the CouchbaseClient (on the Couchbase server) and the spy MemcachedClient(on both servers). Over 1000 repetitions of a
cache.getBulk(collection) call surrounded in time stamps, the time stamps claim the calls are getting quicker the more iterations run.
This happens during all three trials, with both clients and both servers.
I am running both the client and the server locally on my Windows machine.
The first call takes about 9-10 milliseconds to complete (from previous reading this is expected), then the numbers drop to 0-3 ms with most occurring in the 1-2 ms range. However, after about 200 iterations, the CouchbaseClient and the MemcachedClient(running on the Memcached server) getBulk() calls drop to between 0-1 ms. The MemcachedClient(running on the Couchbase server) hits the 0-1 ms mark a little bit later, around 400 iterations.
I can't figure out why the fetches keep getting faster and faster. Any light shed on the matter will be greatly appreciated.
Collection<String> collection = new HashSet<String>(); collection.add("p1"); collection.add("p2"); collection.add("p3"); collection.add("p4"); collection.add("p5"); Map<String,Object> m; ///////////////////////////// //time stuff start = System.nanoTime(); m = cache.getBulk(collection); //call to cache finish = System.nanoTime(); total = Math.round((finish - start) / 1000000); //convert to ms fileWriter.write(total + "\r\n"); ////////////////////////////