Hi Dustin,
I have tried the same with the things you have mentioned but still
getting the same result . Below is the program.
MemcachedClient client = new MemcachedClient(new
InetSocketAddress(MEMCACHE_SERVER_DOMAIN, 11211));
public Object getKeyValue(String key, int time,MemcachedClient client)
{
try {
Object myObj = null;
long startTime = 0;
long deliverTime = 0;
if (client != null) {
startTime = System.currentTimeMillis();
myObj = client.get(key);
deliverTime = System.currentTimeMillis();
} else {
s_logger.error("Not able to get client. Check on high
priority.");
}
long diff = deliverTime - startTime;
s_logger.error("Time to deliver key " + key + " is " +
diff);
return myObj;
} catch (Exception e) {
s_logger.error("Not able to get KeyValue pair for key " +
key, e);
}
return null;
}
On May 23, 10:47 pm, Dustin <[email protected]> wrote:
> On May 23, 2:04 am, Ashu gupta <[email protected]> wrote:
>
> > client = getFreeClient();
>
> What is getFreeClient()? That feels like it'd be complicated. Have
> you tried this test with just a plain client being reused for every
> iteration?
>
> (yes, I realize it's not actually being timed itself, but depending
> on what it does, it could easily have a large effect on the timing)
>
> > long startTime = 0;
> > long deliverTime = 0;
> > if (client != null) {
> > startTime = Calendar.getInstance().getTimeInMillis();
>
> Isn't this an exceedingly slow way to call
> System.currentTimeMillis() ?