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, you should build from source and
use the --enable-dtrace
option. For more
information, see Section 4.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
— pointer to the connection
object
conn-destroy(ptr)
Fired when a connection object is being destroyed.
Arguments:
ptr
— 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 id
threadid
— the thread id
slabs-allocate(size, slabclass, slabsize,
ptr)
Allocate memory from the slab allocator
Arguments:
size
— the requested size
slabclass
— the allocation will
be fulfilled in this class
slabsize
— the size of each
item in this class
ptr
— pointer to allocated
memory
slabs-allocate-failed(size, slabclass)
Failed to allocate memory (out of memory)
Arguments:
size
— the requested size
slabclass
— the class that
failed to fulfill the request
slabs-slabclass-allocate(slabclass)
Fired when a slab class needs more space
Arguments:
slabclass
— class that needs
more memory
slabs-slabclass-allocate-failed(slabclass)
Failed to allocate memory (out of memory)
Arguments:
slabclass
— the class that
failed grab more memory
slabs-free(size, slabclass, ptr)
Release memory
Arguments:
size
— the size of the memory
slabclass
— the class the
memory belongs to
ptr
— 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 for
depth
— 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 inserted
nokeys
— 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 deleted
nokeys
— 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 key
size
— the size of the data
item-unlink(key, size)
Fired when an item is being deleted
Arguments:
key
— the items key
size
— the size of the data
item-remove(key, size)
Fired when the refcount for an item is reduced
Arguments:
key
— the items key
size
— the size of the data
item-update(key, size)
Fired when the "last referenced" time is updated
Arguments:
key
— the items key
size
— 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
replace
oldsize
— the size of the old
item
newkey
— the key of the new
item
newsize
— the size of the new
item
process-command-start(connid, request,
size)
Fired when the processing of a command starts
Arguments:
connid
— the connection id
request
— the incoming request
size
— the size of the request
process-command-end(connid, response,
size)
Fired when the processing of a command is done
Arguments:
connid
— the connection id
respnse
— the response to send
back to the client
size
— the size of the response
command-get(connid, key, size)
Fired for a get-command
Arguments:
connid
— connection id
key
— requested key
size
— size of the key's data
(or -1 if not found)
command-gets(connid, key, size, casid)
Fired for a gets command
Arguments:
connid
— connection id
key
— requested key
size
— 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
— connection id
key
— requested key
size
— 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
— connection id
key
— requested key
size
— 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
— connection id
key
— requested key
size
— 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
— connection id
key
— requested key
size
— 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
— connection id
key
— requested key
size
— 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
— connection id
key
— requested key
size
— 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
— connection id
key
— the requested key
val
— the new value
command-decr(connid, key, val)
Fired for decr command
Arguments:
connid
— connection id
key
— the requested key
val
— the new value
command-delete(connid, key, exptime)
Fired for a delete command
Arguments:
connid
— connection id
key
— the requested key
exptime
— the expiry time