memcached includes a number of different DTrace probes that can be used to monitor the operation of the server. The probes included can monitor individual connections, slab allocations, and modifications to the hash table when a key/value pair is added, updated, or removed.
For more information on DTrace and writing DTrace scripts, read the DTrace User Guide.
Support for DTrace probes was added to
memcached 1.2.6 includes a number of DTrace
probes that can be used to help monitor your application. DTrace
is supported on Solaris 10, OpenSolaris, Mac OS X 10.5 and
FreeBSD. To enable the DTrace probes in
memcached, build from source and use the
--enable-dtrace
option. For more information,
see Section 14.5.1, “Installing memcached”.
The probes supported by memcached are:
conn-allocate(connid)
Fired when a connection object is allocated from the connection pool.
connid
: The connection ID
conn-release(connid)
Fired when a connection object is released back to the connection pool.
Arguments:
connid
: The connection ID
conn-create(ptr)
Fired when a new connection object is being created (that is, there are no free connection objects in the connection pool).
Arguments:
ptr
: A pointer to the connection object
conn-destroy(ptr)
Fired when a connection object is being destroyed.
Arguments:
ptr
: A pointer to the connection object
conn-dispatch(connid, threadid)
Fired when a connection is dispatched from the main or connection-management thread to a worker thread.
Arguments:
connid
: The connection IDthreadid
: The thread ID
slabs-allocate(size, slabclass, slabsize, ptr)
Allocate memory from the slab allocator
Arguments:
size
: The requested sizeslabclass
: The allocation is fulfilled in this classslabsize
: The size of each item in this classptr
: A pointer to allocated memory
slabs-allocate-failed(size, slabclass)
Failed to allocate memory (out of memory)
Arguments:
size
: The requested sizeslabclass
: The class that failed to fulfill the request
slabs-slabclass-allocate(slabclass)
Fired when a slab class needs more space
Arguments:
slabclass
: The class that needs more memory
slabs-slabclass-allocate-failed(slabclass)
Failed to allocate memory (out of memory)
Arguments:
slabclass
: The class that failed to grab more memory
slabs-free(size, slabclass, ptr)
Release memory
Arguments:
size
: The size of the memoryslabclass
: The class the memory belongs toptr
: A pointer to the memory to release
assoc-find(key, depth)
Fired when the when we have searched the hash table for a named key. These two elements provide an insight in how well the hash function operates. Traversals are a sign of a less optimal function, wasting cpu capacity.
Arguments:
key
: The key searched fordepth
: The depth in the list of hash table
assoc-insert(key, nokeys)
Fired when a new item has been inserted.
Arguments:
key
: The key just insertednokeys
: The total number of keys currently being stored, including the key for which insert was called.
assoc-delete(key, nokeys)
Fired when a new item has been removed.
Arguments:
key
: The key just deletednokeys
: The total number of keys currently being stored, excluding the key for which delete was called.
item-link(key, size)
Fired when an item is being linked in the cache
Arguments:
key
: The items keysize
: The size of the data
item-unlink(key, size)
Fired when an item is being deleted
Arguments:
key
: The items keysize
: The size of the data
item-remove(key, size)
Fired when the refcount for an item is reduced
Arguments:
key
: The items keysize
: The size of the data
item-update(key, size)
Fired when the "last referenced" time is updated
Arguments:
key
: The items keysize
: The size of the data
item-replace(oldkey, oldsize, newkey, newsize)
Fired when an item is being replaced with another item
Arguments:
oldkey
: The key of the item to replaceoldsize
: The size of the old itemnewkey
: The key of the new itemnewsize
: The size of the new item
process-command-start(connid, request, size)
Fired when the processing of a command starts
Arguments:
connid
: The connection IDrequest
: The incoming requestsize
: The size of the request
process-command-end(connid, response, size)
Fired when the processing of a command is done
Arguments:
connid
: The connection IDrespnse
: The response to send back to the clientsize
: The size of the response
command-get(connid, key, size)
Fired for a get-command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The size of the key's data (or -1 if not found)
command-gets(connid, key, size, casid)
Fired for a gets command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The size of the key's data (or -1 if not found)casid
: The casid for the item
command-add(connid, key, size)
Fired for a add-command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The new size of the key's data (or -1 if not found)
command-set(connid, key, size)
Fired for a set-command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The new size of the key's data (or -1 if not found)
command-replace(connid, key, size)
Fired for a replace-command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The new size of the key's data (or -1 if not found)
command-prepend(connid, key, size)
Fired for a prepend-command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The new size of the key's data (or -1 if not found)
command-append(connid, key, size)
Fired for a append-command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The new size of the key's data (or -1 if not found)
command-cas(connid, key, size, casid)
Fired for a cas-command
Arguments:
connid
: The connection IDkey
: The requested keysize
: The size of the key's data (or -1 if not found)casid
: The cas ID requested
command-incr(connid, key, val)
Fired for incr command
Arguments:
connid
: The connection IDkey
: The requested keyval
: The new value
command-decr(connid, key, val)
Fired for decr command
Arguments:
connid
: The connection IDkey
: The requested keyval
: The new value
command-delete(connid, key, exptime)
Fired for a delete command
Arguments:
connid
: The connection IDkey
: The requested keyexptime
: The expiry time