Rewrite the "timers" in memcached?
Trond Norbye
Trond.Norbye at Sun.COM
Wed Mar 12 14:24:29 UTC 2008
Hi,
Memcached currently use timers in libevent to keep the "current time"
variable up to date (and to run deferred deletes every 5. seconds).
These timers are added to the main-base used by thread 0, so that
thread 0 will get these timer-callbacks. This sounds like a good idea,
but there is one problem with this. Libevent will read out the system
time _every time_ it will look for new IO-requests (in order to notify
underlaying IO subsystem for how long it should wait for IO-requests).
I created a small prototype today that creates a "maintenance-thread"
whose sole purpose is to update the "clock" and run deferred deletes,
and hence remove all of the clock_gettime-calls from libevent.
So I guess my questions is: What is the status of the single-threaded
version? Should my patch support both the singlethreaded version
(meaning that I have to keep the old version), or should I just post a
patch that use a dedicated thread for timers?
Trond
More information about the memcached
mailing list