{"id":426,"date":"2012-07-27T08:14:52","date_gmt":"2012-07-27T07:14:52","guid":{"rendered":"http:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/"},"modified":"2012-07-27T08:14:52","modified_gmt":"2012-07-27T07:14:52","slug":"displaying-realtime-memcached-traffic-on-a-backend","status":"publish","type":"post","link":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/","title":{"rendered":"Displaying realtime memcached traffic on a backend"},"content":{"rendered":"<p>Sometimes I like to write down posts like this, to remind myself how to do something, sort of a mental note.<br \/>\nSuppose you have a few application servers that use 1+ memcached servers, and you want some way to display the <strong>outbound traffic<\/strong>, providing some insights on what are the most used keys, counters, etc&#8230;<\/p>\n<p>Here&#39;s a quick way to do that, assuming you&#39;re using the memcached text protocol:<\/p>\n<pre><code>tcpflow -ce dst port 11211 \r\n    | cut -b53- \r\n    | grep ^get \r\n    | pipestat --clear --runtime 60 --field 2 --time 1 --limit 40\r\n<\/code><\/pre>\n<p>What this does is:<\/p>\n<ul>\n<li>Use <a href=\"https:\/\/github.com\/simsong\/tcpflow\/wiki\/tcpflow-\u00e2\u20ac\u201d-A-tcp-ip-session-reassembler\" rel=\"nofollow\">tcpflow<\/a> to capture all outbound traffic to destination port 11211, default memcached port.<\/li>\n<li>Remove the first 53 bytes from each line, to filter out source and destination ip\/ports<\/li>\n<li>Only display <strong>get<\/strong> requests (alternatively, use <code>set<\/code>, <code>incr<\/code>, &#8230;)<\/li>\n<li>Feed the resulting data to <a href=\"http:\/\/audun.ytterdal.net\/2009\/04\/pipestat\" rel=\"nofollow\">pipestat<\/a>, a simple but great Perl tool that aggregates the data, displaying the most frequent ones. The specific options I used are good if you want to display quick statistics like other tools as <code>top<\/code>, <code>mytop<\/code>, or <code>varnishstat<\/code>.\n<\/li>\n<\/ul>\n<p>It goes without saying that these tools are automatically installed on all servers that our Devops team here at Opera manages. I couldn&#39;t work without them :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes I like to write down posts like this, to remind myself how to do something, sort of a mental note. Suppose you have a few application servers that use 1+ memcached servers, and you want some way to display the outbound traffic, providing some insights on what are the most used keys, counters, etc&#8230; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[220,219,50,218,217,61],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Displaying realtime memcached traffic on a backend - Random hacking<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Displaying realtime memcached traffic on a backend - Random hacking\" \/>\n<meta property=\"og:description\" content=\"Sometimes I like to write down posts like this, to remind myself how to do something, sort of a mental note. Suppose you have a few application servers that use 1+ memcached servers, and you want some way to display the outbound traffic, providing some insights on what are the most used keys, counters, etc&#8230; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/\" \/>\n<meta property=\"og:site_name\" content=\"Random hacking\" \/>\n<meta property=\"article:published_time\" content=\"2012-07-27T07:14:52+00:00\" \/>\n<meta name=\"author\" content=\"cosimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cosimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/\"},\"author\":{\"name\":\"cosimo\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"headline\":\"Displaying realtime memcached traffic on a backend\",\"datePublished\":\"2012-07-27T07:14:52+00:00\",\"dateModified\":\"2012-07-27T07:14:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/\"},\"wordCount\":182,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"keywords\":[\"memcached\",\"operations\",\"perl\",\"pipestat\",\"tcpflow\",\"webops\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/\",\"name\":\"Displaying realtime memcached traffic on a backend - Random hacking\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\"},\"datePublished\":\"2012-07-27T07:14:52+00:00\",\"dateModified\":\"2012-07-27T07:14:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Displaying realtime memcached traffic on a backend\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\",\"name\":\"Random hacking\",\"description\":\"Assume nothing. Code defensively. Keep it simple, stupid!\",\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\",\"name\":\"cosimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"caption\":\"cosimo\"},\"logo\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Displaying realtime memcached traffic on a backend - Random hacking","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/","og_locale":"en_US","og_type":"article","og_title":"Displaying realtime memcached traffic on a backend - Random hacking","og_description":"Sometimes I like to write down posts like this, to remind myself how to do something, sort of a mental note. Suppose you have a few application servers that use 1+ memcached servers, and you want some way to display the outbound traffic, providing some insights on what are the most used keys, counters, etc&#8230; [&hellip;]","og_url":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/","og_site_name":"Random hacking","article_published_time":"2012-07-27T07:14:52+00:00","author":"cosimo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"cosimo","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#article","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/"},"author":{"name":"cosimo","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"headline":"Displaying realtime memcached traffic on a backend","datePublished":"2012-07-27T07:14:52+00:00","dateModified":"2012-07-27T07:14:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/"},"wordCount":182,"commentCount":0,"publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"keywords":["memcached","operations","perl","pipestat","tcpflow","webops"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/","url":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/","name":"Displaying realtime memcached traffic on a backend - Random hacking","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website"},"datePublished":"2012-07-27T07:14:52+00:00","dateModified":"2012-07-27T07:14:52+00:00","breadcrumb":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2012\/07\/displaying-realtime-memcached-traffic-on-a-backend\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.streppone.it\/cosimo\/blog\/"},{"@type":"ListItem","position":2,"name":"Displaying realtime memcached traffic on a backend"}]},{"@type":"WebSite","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website","url":"https:\/\/www.streppone.it\/cosimo\/blog\/","name":"Random hacking","description":"Assume nothing. Code defensively. Keep it simple, stupid!","publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1","name":"cosimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","caption":"cosimo"},"logo":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/426"}],"collection":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/comments?post=426"}],"version-history":[{"count":0,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/426\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/media?parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/categories?post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/tags?post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}