1. memcached is installed on the machine where my file is so that
takes care of your concern ( memory on a different machine ).
network is network. A localhost vs. local lan requests are the same in
terms of overhead for requests as small as memcached.
2. I am not just reading a single file everytime. I have 3 data files
that I access in the script (system may be caching files in memory)
Yeah, try hundreds of files, being read hundreds of times per second.
3. Even if the files are not changing does it mean that disk cache is
faster than memcached? that too an extent of disk cache being almost
50% faster than memcached.
Oh hell yes. This is the entire basis behind Varnish, the caching proxy
server. The kernel and/or the filesystem manages file cache. You don't
get more low level than that.
I am sorry, but I don't think your explanation addresses my concerns.
If your file based approach works, why are you looking at memcached?
As for failures, I assume you mean failures reported by Apache Bench.
My guess is that you are not using threaded mode or are not tuning your
thread count appropriately for memcached and hitting the same 3 keys for
say 1000 concurrent requests could cause some contention.
Brian.