PATCH: Add DTrace probes

Roy Lyseng Roy.Lyseng at Sun.COM
Fri Mar 7 13:37:37 UTC 2008


Another, slightly more advanced script is memcached-keytrace.d:

:memcached::command-set,command-add,command-delete,command-get
/pid == $target && copyinstr(arg1) == "123456789"/
{
     trace(copyinstr(arg1));
}

END
{
}

This one will trace set, add, delete and get commands applied to one 
specific key:

Invoke as:

dtrace -s ~/memcached/dtrace/memcached-trace.d -p 24167

Then run a telnet session:

telnet system 11211
Trying 9.9.9.9...
Connected to system.
Escape character is '^]'.
abcdefghij
ERROR
set 123456789 0 0 10
abcdefghij
STORED
delete 123456789 0 0
DELETED
get 123456789 0 0 0
END

And the dtrace script reports:

CPU     ID                    FUNCTION:NAME
   1  54165       complete_nread:command-set   123456789 

   0  54159 process_delete_command:command-delete   123456789
   1  54160  process_get_command:command-get   123456789

Useful? Maybe...

Roy
Dustin Sallings wrote:
> 
>   For those of us who haven't truly unleashed the power of dtrace, can 
> you describe the kinds of things we can learn from this (perhaps with 
> scripts)?
> 
> --Dustin Sallings (mobile)
> 
> On Mar 6, 2008, at 4:48, Trond Norbye <Trond.Norbye at Sun.COM> wrote:
> 
>>
>> On Mar 5, 2008, at 3:52 PM, Trond Norbye wrote:
>>
>>> The following patch adds a new configure-option (--enable-dtrace) 
>>> that adds DTrace probes to various parts of memcached.
>>>
>>> Please comment.
>>>
>>> Trond
>>
>> I discovered that I had some "leftovers" in this patch from before I 
>> fixed the comments regarding the large page support..
>>
>> The attached version is replacement for the original patch.
>>
>> Trond
>> <dtrace.patch.gz>
>>


More information about the memcached mailing list