The memcached distributed cache is used by many web 2.0 data centers
to improve scalability.
http://memcached.org/
The following patch embeds sFlow instrumentation in memcached:
http://groups.google.com/group/memcached/browse_thread/thread/70a49dff7ad9ab86
The structures attached to this message are currently being used to
export counters and sampled operations. Any comments?
For some background on how sFlow network, server and application
monitoring fit together, see:
http://blog.sflow.com/2010/08/sflow-host-structures.html
Peter
--------------------------
/* The memcached_protocol enumeration may be expanded over time.
Applications receiving sFlow must be prepared to receive
memcached_operation structures with unknown memcached_protocol
values */
enum memcached_protocol {
OTHER = 0;
ASCII = 1;
BINARY = 2;
}
/* The memcached_cmd enumeration may be expanded over time.
Applications receiving sFlow must be prepared to receive
memcached_operation structures with unknown memcached_cmd
values */
enum memcached_cmd {
OTHER = 0;
SET = 1;
ADD = 2;
REPLACE = 3;
APPEND = 4;
PREPEND = 5;
CAS = 6;
GET = 7;
GETS = 8;
}
/* The memcached_status enumeration may be expanded over time.
Applications receiving sFlow must be prepared to receive
memcached_operation structures with unknown memcached_status
values */
enum memcached_status {
UNKNOWN = 0;
OK = 1;
ERROR = 2;
CLIENT_ERROR = 3;
SERVER_ERROR = 4;
STORED = 5;
NOT_STORED = 6;
EXISTS = 7;
NOT_FOUND = 8;
DELETED = 9;
}
/* Memcached operation */
/* opaque = flow_data; enterprise = 0; format = 2200 */
struct memcached_operation {
memcached_protocol protocol; /* protocol */
memcached_cmd cmd; /* command */
string<255> key; /* key used to storage retrieve data */
unsigned int nkeys; /* number of keys (including sampled
key) */
unsigned int value_bytes; /* size of the value (in bytes) */
unsigned int uS; /* duration of the operation
(microseconds) */
memcached_status status; /* status of command */
}
/* Memcached counters */
/* See memcached protocol.txt */
/* opaque = counter_data; enterprise = 0; format = 2200 */
struct memcached_counters {
unsigned int uptime; /* in seconds */
unsigned int rusage_user; /* in milliseconds */
unsigned int rusage_system; /* in milliseconds */
unsigned int curr_connections;
unsigned int total_connections;
unsigned int connection_structures;
unsigned int cmd_get;
unsigned int cmd_set;
unsigned int cmd_flush;
unsigned int get_hits;
unsigned int get_misses;
unsigned int delete_misses;
unsigned int delete_hits;
unsigned int incr_misses;
unsigned int incr_hits;
unsigned int decr_misses;
unsigned int decr_hits;
unsigned int cas_misses;
unsigned int cas_hits;
unsigned int cas_badval;
unsigned int auth_cmds;
unsigned int auth_errors;
unsigned hyper bytes_read;
unsigned hyper bytes_written;
unsigned int limit_maxbytes;
unsigned int accepting_conns;
unsigned int listen_disabled_num;
unsigned int threads;
unsigned int conn_yields;
unsigned hyper bytes;
unsigned int curr_items;
unsigned int total_items;
unsigned int evictions;
}