memcached/memcached — pull request #62 by jsipprell (2014-03-07 04:34:45+00:00)
Title: hacked in some basic idle timeout functionality

**Idle timeout support:**

The following PR provides basic idle timeout support for the 1.4 tree. I realize this isn't the "active development" branch, but it is the one I was required to work with so this is what I'm sending back upstream.

Timeouts are configured globally, in seconds, via the `-T` command line argument. Default timeout is 0 -- *no timeout*. Each connection's timer is, of course, distinct. Each connection's idle timer is reset to the global initial value during *any* I/O and cleared when a connection is finalized. Idle timeouts are not meaningful with regard to UDP sockets and thus are not applied to them. Timeouts are handled synchronously, via libevent, and will perform a clean disconnect if/when they fire on a valid active connection.

Idle timeout support is enabled via ``./configure --enable-idle-timouts``, but one must still supply `-T` on the command line to activate at run-time.

A new stat is provided to track idle disconnections -``idle_disconnected_connections``. This counter can be viewed just like the rest of the general statistics.

Use of this feature is not recommended in extremely high connection count environments as the overhead could begin to take its toll when there are many thousands of concurrent connections.