<?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>Linux, Open Source and Web 2.0 &#187; memcached</title>
	<atom:link href="http://www.itecsoftware.com/tag/memcached/feed" rel="self" type="application/rss+xml" />
	<link>http://www.itecsoftware.com</link>
	<description>Itec Software</description>
	<lastBuildDate>Sun, 13 May 2012 19:34:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Redis High Speed Storage Or Cache System</title>
		<link>http://www.itecsoftware.com/redis-high-speed-storage-or-cache-system?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=redis-high-speed-storage-or-cache-system</link>
		<comments>http://www.itecsoftware.com/redis-high-speed-storage-or-cache-system#comments</comments>
		<pubDate>Wed, 11 Aug 2010 18:05:14 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Useful Stuff]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[Redis]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=498</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/redis-high-speed-storage-or-cache-system" title="Redis High Speed Storage Or Cache System"></a>NoSQL databases are the hype, with MongoBD and CouchDB on the forefront, while Memcache has found a place in many high load web applications during the past few years. Each of these applications has their own, very specific characteristic. MongoDB &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/redis-high-speed-storage-or-cache-system">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/redis-high-speed-storage-or-cache-system" title="Redis High Speed Storage Or Cache System"></a><!-- google_ad_section_start --><p>NoSQL databases are the hype, with <a href="http://www.mongodb.org/" target="_blank">MongoBD</a> and <a href="http://couchdb.apache.org/" target="_self">CouchDB</a> on the forefront, while Memcache has found a place in many high load web applications during the past few years. Each of these applications has their own, very specific characteristic. MongoDB finds its usage where single key-value pairs are not sufficient, but adds a slight overhead and complexity with its hash table like multi field storage architecture. CouchDB is an ideal candidate where single key-value pair storage engine is sufficient.</p>
<p>And there is Redis, the new kid on the block. Redis is a high speed storage or cache system, much like <a href="http://memcached.org/" target="_blank">Memcache</a> on steroids. Redis writes data into memory, which makes it really fast. And in contrast to Memcache, it writes data periodically to disk depending on the amount of data that has changed. Redis is been said to be able to handle in excess of 10&#8217;000 reads/writes per second!<span id="more-498"></span></p>
<p>In contrast to Memcache, Redis has its own client language. The basic &#8220;set&#8221; and &#8220;get&#8221; are pretty much standard, but we can increment values, set lists and sets and easily handle key replacements and checks for existing values.</p>
<p>As of this writing, <a href="http://code.google.com/p/redis/downloads/detail?name=redis-2.0.0-rc4.tar.gz&amp;can=2&amp;q=" target="_blank">version 2</a> is in Release Candidate 4. For production environments, you&#8217;re highly encouraged to use the stable <a href="http://code.google.com/p/redis/downloads/detail?name=redis-1.2.6.tar.gz&amp;can=2&amp;q=" target="_blank">version 1.2.6</a>. To install Redis, download the desired version, untar and switch to the Redis directory. There is no configure script, we just call make, then copy &#8220;redis_server&#8221; and &#8220;redis-cli&#8221; to your desired location (eg. /usr/local/bin) and copy redis.conf to /etc/. Let&#8217;s start it up! Although I downloaded version 2 RC 4, the server shows version 1.3.17:</p>
<p><span style="color: #008000;">redis-server</span><br />
<span style="color: #008000;">[3926] 11 Aug 10:42:33 * Server started, Redis version 1.3.17</span><br />
<span style="color: #008000;">[3926] 11 Aug 10:42:33 * The server is now ready to accept connections on port 6379</span><br />
<span style="color: #008000;">[3926] 11 Aug 10:42:33 &#8211; 0 clients connected (0 slaves), 1074272 bytes in use</span><br />
<span style="color: #008000;">[3926] 11 Aug 10:42:33 * Server started, Redis version 1.3.17</span><br />
<span style="color: #008000;">[3926] 11 Aug 10:42:33 * The server is now ready to accept connections on port 6379</span><br />
<span style="color: #008000;">[3926] 11 Aug 10:42:33 &#8211; 0 clients connected (0 slaves), 1074272 bytes in use</span></p>
<p>We can now use Telnet to connect on port 6379 or use the Command Line Interface that comes with Redis (redis-cli) and issue some commands:<br />
<span style="color: #008000;"><br />
redis&gt; get firstName<br />
(nil)<br />
redis&gt; set firstName Peter<br />
OK<br />
redis&gt; get firstName<br />
&#8220;Peter&#8221;<br />
redis&gt; setnx firstName Peters<br />
(integer) 0<br />
redis&gt; get firstName<br />
&#8220;Peter&#8221;<br />
redis&gt; setnx firstNames Peters<br />
(integer) 1<br />
redis&gt; get firstNames<br />
&#8220;Peters&#8221;<br />
redis&gt;<br />
</span><br />
Complete command reference can be found <a href="http://code.google.com/p/redis/wiki/CommandReference" target="_blank">here</a> and it&#8217;s highly encouraged that you play around with them and get familiar with the CLI commands. It is really amazing what Redis provides in terms of powerful memory storage solution coupled with such an easy setup and usage. One thing is for sure, we&#8217;re hooked.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/redis-high-speed-storage-or-cache-system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Memcached Using Telnet Commands</title>
		<link>http://www.itecsoftware.com/testing-memcached-using-telnet-commands?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=testing-memcached-using-telnet-commands</link>
		<comments>http://www.itecsoftware.com/testing-memcached-using-telnet-commands#comments</comments>
		<pubDate>Tue, 08 Jun 2010 19:21:51 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=388</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/testing-memcached-using-telnet-commands" title="Testing Memcached Using Telnet Commands"></a>Troubleshooting memcached is not so transparent as some other technologies, but testing memcached using telnet commands can give us quite some insight on what&#8217;s happening under the hood. Following is a short list of useful commands to inspect a running &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/testing-memcached-using-telnet-commands">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/testing-memcached-using-telnet-commands" title="Testing Memcached Using Telnet Commands"></a><!-- google_ad_section_start --><p>Troubleshooting memcached is not so transparent as some other technologies, but testing memcached using telnet commands can give us quite some insight on what&#8217;s happening under the hood.</p>
<p>Following is a short list of useful commands to  inspect a running <a href="http://www.danga.com/memcached/">memcached</a> instance.</p>
<h4><span style="text-decoration: underline;">How to find the IP address and port to connect:</span></h4>
<p><span style="color: #008000;">ps aux | grep memcached</span> will give us the process running memcached, with listening ip address and port. If this command does not yield any results, you likely not running the daemon and need to start it up first.</p>
<h4><span style="text-decoration: underline;">We can now connect using this info:</span></h4>
<p><span style="color: #008000;">telnet 127.0.0.1 11211</span> (replace your IP address and port)</p>
<h4><span style="text-decoration: underline;">Supported Commands:</span></h4>
<p>The following is a list of the most important memcached commands. For a more complete list of supported commands, check out the <a href="http://code.google.com/p/memcached/wiki/NewCommands">memcached wiki</a> document.<span id="more-388"></span></p>
<table style="margin: 10px 0 20px 10px;">
<tbody style="border: 1px gray solid;">
<tr>
<th style="text-align: left;" width="100">Command</th>
<th style="text-align: left;">Description</th>
<th style="text-align: left;">Example</th>
</tr>
<tr>
<td>get</td>
<td>Reads a value</td>
<td>get mykey</td>
</tr>
<tr>
<td>set</td>
<td>Set a key unconditionally</td>
<td>set mykey 0 60 5</td>
</tr>
<tr>
<td>add</td>
<td>Add a new key</td>
<td>add newkey 0 60 5</td>
</tr>
<tr>
<td>replace</td>
<td>Overwrite existing key</td>
<td>replace key 0 60 5</td>
</tr>
<tr>
<td>append</td>
<td>Append data to existing key</td>
<td>append key 0 60 15</td>
</tr>
<tr>
<td>prepend</td>
<td>Prepend data to existing key</td>
<td>prepend key 0 60 15</td>
</tr>
<tr>
<td>incr</td>
<td>Increments numerical key value by given number</td>
<td>incr mykey 2</td>
</tr>
<tr>
<td>decr</td>
<td>Decrements numerical key value by given number</td>
<td>decr mykey 5</td>
</tr>
<tr>
<td>delete</td>
<td>Deletes an existing key</td>
<td>delete mykey</td>
</tr>
<tr>
<td rowspan="2">flush_all</td>
<td>Invalidate specific items immediately</td>
<td>flush_all</td>
</tr>
<tr>
<td>Invalidate all items in n seconds</td>
<td>flush_all 900</td>
</tr>
<tr>
<td rowspan="7">stats</td>
<td>Prints general statistics</td>
<td>stats</td>
</tr>
<tr>
<td>Prints memory statistics</td>
<td>stats slabs</td>
</tr>
<tr>
<td>Prints memory statistics</td>
<td>stats malloc</td>
</tr>
<tr>
<td>Print higher level allocation statistics</td>
<td>stats items</td>
</tr>
<tr>
<td></td>
<td>stats detail</td>
</tr>
<tr>
<td></td>
<td>stats sizes</td>
</tr>
<tr>
<td>Resets statistics</td>
<td>stats reset</td>
</tr>
<tr>
<td>version</td>
<td>Prints server version.</td>
<td>version</td>
</tr>
<tr>
<td>verbosity</td>
<td>Increases log level</td>
<td>verbosity</td>
</tr>
<tr>
<td>quit</td>
<td>Terminate telnet session</td>
<td>qui</td>
</tr>
</tbody>
</table>
<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "pub-5075229468189091"; google_ad_slot = "5319549306"; google_ad_width = 468; google_ad_height = 60;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
<h4><span style="text-decoration: underline;">Traffic Statistics:</span></h4>
<p><span style="color: #008000;">stats</span> will give you general info on version, traffic, hits/misses, connections and more.</p>
<p>Example Output:</p>
<pre>STAT pid 14868
STAT uptime 175931
STAT time 1220540125
STAT version 1.2.2
STAT pointer_size 32
STAT rusage_user 620.299700
STAT rusage_system 1545.703017
STAT curr_items 228
STAT total_items 779
STAT bytes 15525
STAT curr_connections 92
STAT total_connections 1740
STAT connection_structures 165
STAT cmd_get 7411
STAT cmd_set 28445156
STAT get_hits 5183
STAT get_misses 2228
STAT evictions 0
STAT bytes_read 2112768087
STAT bytes_written 1000038245
STAT limit_maxbytes 52428800
STAT threads 1
END
</pre>
<h4><span style="text-decoration: underline;">Memory Statistics:</span></h4>
<p><span style="color: #008000;">stats slabs</span> gives you detailed memory statistics</p>
<p>Example Output:</p>
<pre>STAT 1:chunk_size 80
STAT 1:chunks_per_page 13107
STAT 1:total_pages 1
STAT 1:total_chunks 13107
STAT 1:used_chunks 13106
STAT 1:free_chunks 1
STAT 1:free_chunks_end 12886
STAT 2:chunk_size 100
STAT 2:chunks_per_page 10485
STAT 2:total_pages 1
STAT 2:total_chunks 10485
STAT 2:used_chunks 10484
STAT 2:free_chunks 1
STAT 2:free_chunks_end 10477
[...]
STAT active_slabs 3
STAT total_malloced 3145436
END
</pre>
<h4><span style="text-decoration: underline;">Items Statistics:</span></h4>
<p><span style="color: #008000;">stats items</span> lets you know the item count and their age.</p>
<p>Example Output:</p>
<pre>stats items
STAT items:1:number 220
STAT items:1:age 83095
STAT items:2:number 7
STAT items:2:age 1405
[...]
END
</pre>
<p>Using Telnet to get details about memcache is a nice way of looking under the hood or a running production system, where outputting variables in PHP or ASP .NET is not feasible. Zero values in hit/misses indicate that memcache in not used for some reason, connection errors may hint to a networking or permission issue. And with too many evictions you may need to increase the allocated amount of memory.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/testing-memcached-using-telnet-commands/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hot To Install Memcache And PHP Client On Mac Snow Leopard</title>
		<link>http://www.itecsoftware.com/hot-to-install-memcache-and-php-client-on-mac-snow-leopard?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hot-to-install-memcache-and-php-client-on-mac-snow-leopard</link>
		<comments>http://www.itecsoftware.com/hot-to-install-memcache-and-php-client-on-mac-snow-leopard#comments</comments>
		<pubDate>Mon, 08 Feb 2010 23:59:32 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[PECL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5-memache]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=346</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/hot-to-install-memcache-and-php-client-on-mac-snow-leopard" title="Hot To Install Memcache And PHP Client On Mac Snow Leopard"></a>I recently installed the memcached daemon on my MacBook Pro, incuding the necessary PHP client for development purposes. I just prefer to work locally instead of using a VM running Linux. And the process is actually quite simple and straight &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/hot-to-install-memcache-and-php-client-on-mac-snow-leopard">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/hot-to-install-memcache-and-php-client-on-mac-snow-leopard" title="Hot To Install Memcache And PHP Client On Mac Snow Leopard"></a><!-- google_ad_section_start --><p>I recently installed the memcached daemon on my MacBook Pro, incuding the necessary PHP client for development purposes. I just prefer to work locally instead of using a VM running Linux. And the process is actually quite simple and straight forward. Please note, I have included both clients, the old standard one and the newer PECL extension, because I deal with different applications and also lots of people seems to get confused when they install one version and their memcache classes cannot get instantiated and throw errors. So, if in doubt, just install both.</p>
<p>These are the five (four if you know which extension you want) components needed:</p>
<p>- libevent (requred library for memcached)</p>
<p>- memcached daemon</p>
<p>- libmemcached (required library for the php client)</p>
<p>- php extension (standard)</p>
<p>- php extension (PECL)</p>
<p>Now open your terminal and off we go:<span id="more-346"></span></p>
<p><em> Note: if you don&#8217;t want to install wget, you can alternatively use &#8220;curl -O&#8221;)</em></p>
<p><span style="color: #008000;"><strong><span style="color: #000000;">Installing libevent:</span></strong></span><br />
<span style="color: #008000;"><br />
$ cd /tmp<br />
$ wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz (if you&#8217;re brave, you can try the 2.0 beta)<br />
$ tar zxvf libevent-1.4.13-stable.tar.gz<br />
$ ./configure<br />
$ make<br />
$ sudo make install</span></p>
<p><span style="color: #008000;"><strong><span style="color: #000000;">Installing memcached:</span></strong></span></p>
<p><span style="color: #008000;">$ wget http://memcached.googlecode.com/files/memcached-1.4.1.tar.gz<br />
$ tar xzvf memcached-1.4.1.tar.gz<br />
$ cd memcached-1.4.1<br />
$ ./configure<br />
$ make<br />
$ make test<br />
$ sudo make install</span><br />
<span style="color: #008000;">$ memcached -d -P pidfile -l 127.0.0.1</span> (this will start the memcached daemon)<br />
<span style="color: #008000;">$ ps aux | grep &#8216;memcached&#8217; <span style="color: #000000;">(this should confirm that memcached is running and how much memory is assigned to it)</span></span></p>
<p><strong><span style="color: #008000;"><span style="color: #000000;">Installing libmemcached:</span></span></strong></p>
<p><span style="color: #008000;">$ wget http://launchpad.net/libmemcached/1.0/0.34/+download/libmemcached-0.34.tar.gz<br />
$ tar -zxvf libmemcached-0.34.tar.gz<br />
$ cd libmemcached-0.34<br />
$ ./configure<br />
$ make<br />
$ sudo make install</span></p>
<p><strong><span style="color: #000000;">Installing PECL memcache extension:</span></strong></p>
<p><span style="color: #008000;">$ cd /tmp<br />
$ pecl download memcached<br />
$ tar xzvf memcached-1.0.0.tgz<br />
$ cd memcached-1.0.0<br />
$ phpize<br />
$ ./configure<br />
$ make<br />
$ sudo make install</span></p>
<p><strong><span style="color: #000000;">Installing PHP memcache extension:</span></strong></p>
<p><span style="color: #008000;">$ cd /tmp<br />
$ wget http://pecl.php.net/get/memcache-2.2.4.tgz<br />
$ tar -zxvf memcache-2.2.4.tgz<br />
$ cd memcache-2.2.4<br />
$ phpize &amp;&amp;<br />
$ ./configure<br />
$ make<br />
$ sudo make install</span></p>
<p>Once all the steps are completed successfully, ensure that the extension directory is specified as the same as the output of the terminal after the extensions installed. Otherwise correct in php.ini.</p>
<p>Also add the line(s) to load the extension(s) in the php.ini file, in the extension section:</p>
<p>extension=memcached.so<br />
extension=memcache.so</p>
<p>And finally restart apache:<br />
<span style="color: #008000;">$ sudo apachectl restart</span></p>
<p>And verify in phpinfo that memcache(d) is loaded and working.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/hot-to-install-memcache-and-php-client-on-mac-snow-leopard/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 9/13 queries in 0.003 seconds using disk: basic
Object Caching 578/580 objects using disk: basic

Served from: www.itecsoftware.com @ 2012-05-19 15:18:03 -->
