<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MySQL Performance Blog &#187; monitoring</title>
	<atom:link href="http://www.mysqlperformanceblog.com/category/monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 21 Nov 2009 03:11:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A quick way to get memcached status</title>
		<link>http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/</link>
		<comments>http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 02:32:54 +0000</pubDate>
		<dc:creator>Baron Schwartz</dc:creator>
				<category><![CDATA[memcached]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=547</guid>
		<description><![CDATA[There are all sorts of different interfaces to memcached, but you don't need any of them to make requests from the command line, because its protocol is so simple.  Try this, assuming it's running on the usual port on the local machine:
PLAIN TEXT
CODE:




echo stats &#124; nc 127.0.0.1 11211


STAT pid 22020


STAT uptime 3689364


STAT time 1227753109


STAT [...]]]></description>
			<content:encoded><![CDATA[<p>There are all sorts of different interfaces to memcached, but you don't need any of them to make requests from the command line, because its protocol is so simple.  Try this, assuming it's running on the usual port on the local machine:</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo stats | nc <span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span> <span style="color:#800000;color:#800000;">11211</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT pid <span style="color:#800000;color:#800000;">22020</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT uptime <span style="color:#800000;color:#800000;">3689364</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT time <span style="color:#800000;color:#800000;">1227753109</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT version <span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">5</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT pointer_size <span style="color:#800000;color:#800000;">64</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT rusage_user <span style="color:#800000;color:#800000;">4543</span>.<span style="color:#800000;color:#800000;">071348</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT rusage_system <span style="color:#800000;color:#800000;">8568</span>.<span style="color:#800000;color:#800000;">293421</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT curr_items <span style="color:#800000;color:#800000;">139897</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT total_items <span style="color:#800000;color:#800000;">51710845</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT bytes <span style="color:#800000;color:#800000;">360147055</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT curr_connections <span style="color:#800000;color:#800000;">40</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT total_connections <span style="color:#800000;color:#800000;">66762</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT connection_structures <span style="color:#800000;color:#800000;">327</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT cmd_get <span style="color:#800000;color:#800000;">319992973</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT cmd_set <span style="color:#800000;color:#800000;">51710845</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT get_hits <span style="color:#800000;color:#800000;">280700485</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT get_misses <span style="color:#800000;color:#800000;">39292488</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT evictions <span style="color:#800000;color:#800000;">849165</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT bytes_read <span style="color:#800000;color:#800000;">141320046298</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT bytes_written <span style="color:#800000;color:#800000;">544357801590</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT limit_maxbytes <span style="color:#800000;color:#800000;">402653184</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">STAT threads <span style="color:#800000;color:#800000;">4</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">END </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here's an easy "top" emulator for memcached:</p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">watch <span style="color:#CC0000;">"echo stats | nc 127.0.0.1 11211"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you don't have netcat (nc), you can also use <a href="http://tldp.org/LDP/abs/html/devref1.html">Bash's built-in /proc/tcp magic</a> if it's enabled.  Anything that can push a couple of characters to a TCP port and print the result to stdout will work.  Or you can use something like this, if you must do it via PHP:</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">watch <span style="color:#CC0000;">'php -r '</span><span style="color:#CC0000;">"'"</span><span style="color:#CC0000;">'$m=new Memcache;$m-&gt;connect(&quot;127.0.0.1&quot;, 11211);print_r($m-&gt;getstats());'</span><span style="color:#CC0000;">"'"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Baron Schwartz |
      <a href="http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/#comments">One comment</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/&amp;title=A quick way to get memcached status" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/&amp;title=A quick way to get memcached status" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/&amp;title=A quick way to get memcached status" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/&amp;T=A quick way to get memcached status" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/&amp;title=A quick way to get memcached status" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
