我在memcachedClient中存储了一些值。当我尝试使用get方法获取它时,每次执行时需要一些随机时间,如30 ms或70 ms。以下是我试图测量时间的代码
long l1, l2, l3, l4, l5, l6;
String[] keys = { ("key4") };
l1 = System.currentTimeMillis();
client1.get(("key4"));
l2 = System.currentTimeMillis();
mLogger.info("total time taken in fetching from memcached=" + (l2 - l1));
l4 = l2 - l1;
l5 = System.currentTimeMillis();
Map<String, Object> map = client1.getBulk(keys);
l6 = System.currentTimeMillis();
mLogger.info("total time taken in fetching from memcached using bulk="
+ (l6 - l5));
这里对于l2-l1我会得到一些可测量的值,如70-80 ms。有时500毫秒。我只想减少这个时间。请帮忙。