MySQL HA/Scalability Guide  /  ...  /  Using memcached and DTrace

2.2.5 Using memcached and DTrace

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, 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 2.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 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 is fulfilled in this class.

    • slabsize: The size of each item in this class.

    • ptr: A 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: 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 amount of memory to release, in bytes.

    • slabclass: The class the memory belongs to.

    • ptr: A pointer to the memory to release.

  • assoc-find(key, depth)

    Fired when we have searched the hash table for a named key. These two elements provide an insight into 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 item's key.

    • size: The size of the data.

  • item-update(key, size)

    Fired when the "last referenced" time is updated.

    Arguments:

    • key: The item's 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.

    • response: 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: The connection ID.

    • key: The requested key.

    • size: 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 ID.

    • key: The requested key.

    • size: 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 ID.

    • key: The 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: The connection ID.

    • key: The 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: The connection ID.

    • key: The 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: The connection ID.

    • key: The 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: The connection ID.

    • key: The 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: The connection ID.

    • key: The requested key.

    • size: 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 ID.

    • key: The requested key.

    • val: The new value.

  • command-decr(connid, key, val)

    Fired for decr command.

    Arguments:

    • connid: The connection ID.

    • key: The requested key.

    • val: The new value.

  • command-delete(connid, key, exptime)

    Fired for a delete command.

    Arguments:

    • connid: The connection ID.

    • key: The requested key.

    • exptime: The expiry time.


User Comments
Sign Up Login You must be logged in to post a comment.