<?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>Phil Chen &#187; Systems 101</title>
	<atom:link href="http://www.philchen.com/category/systems-administration-101/feed" rel="self" type="application/rss+xml" />
	<link>http://www.philchen.com</link>
	<description>Phil Chen</description>
	<lastBuildDate>Fri, 23 Jul 2010 03:36:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Velocity: The Ultimate Web Performance and Operations Conference</title>
		<link>http://www.philchen.com/2010/07/16/velocity-the-ultimate-web-performance-and-operations-conference</link>
		<comments>http://www.philchen.com/2010/07/16/velocity-the-ultimate-web-performance-and-operations-conference#comments</comments>
		<pubDate>Fri, 16 Jul 2010 16:45:14 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Development 101]]></category>
		<category><![CDATA[Networking 101]]></category>
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/?p=640</guid>
		<description><![CDATA[&#160;
Last month, I attended O&#8217;Reilly&#8217;s Velocity Web Performance and Operations Conference and, without fail, the information I came away with reinforced existing VMIX initiatives and strategies, and inspired new ones.

Attending the Velocity Conference, I had three goals:

To listen to relevant industry-leading speakers, regarding how to improve performance and operational efficiency, taking this information and disseminating [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;
<p>Last month, I attended <a href="http://en.oreilly.com/velocity2010" target="_blank">O&#8217;Reilly&#8217;s Velocity Web Performance and Operations Conference</a> and, without fail, the information I came away with reinforced existing <a href="http://www.vmix.com" target="_blank">VMIX</a> initiatives and strategies, and inspired new ones.<br />
<span id="more-640"></span><br />
Attending the Velocity Conference, I had three goals:</p>
<ul>
<li>To listen to relevant industry-leading speakers, regarding how to improve performance and operational efficiency, taking this information and disseminating it to my colleagues who couldn&#8217;t attend.</li>
<li>To meet and discuss with peers from companies facing the same challenges and hurdles when it comes to performance and operations. Understanding their approaches and pitfalls while offering my own experiences.</li>
<li>And, finally, being away from interruptions at work, to simply be inspired by the incredibly smart people around me to draft new strategies for increasing scale, efficiency and performance to bring back and implement.</li>
</ul>
<p><h3><a href="http://www.vmix.com/blog/wp-content/uploads/2010/07/velocity.jpg"><img class="alignleft size-medium wp-image-1042" title="O'Reilly's Velocity Web Performance and Operations Conference" src="http://www.vmix.com/blog/wp-content/uploads/2010/07/velocity-300x199.jpg" alt="" width="300" height="199" /></a>It&#8217;s All About the Data</h3>
<p>At Velocity this year, as well as the previous two, I became aware of underlying themes that went beyond specific technologies or tools.</p>
<p>The most important, which in some cases may seem obvious, is to make decisions based on data.</p>
<p>A lot of times, decisions are made based on theory, instinct, wishful thinking and other motivating factors.</p>
<p>Validating these factors with data collected from your applications, infrastructure and clients will allow you to make the most informed decision. The more data points you collect, the higher the odds are that your decisions will result in the kind of outcomes you think they should.</p>
<p>One important method of data collection that is overlooked at times is the <em>human </em>factor. No matter how much our hardware computing evolves, humans still decide which methods or strategies to implement in order to provide a complete solution. And the human brain is still the highest performing computer on the market. Going to a conference and interacting with peers and colleagues on operations and web performance allows us to complete the system.</p>
<h3>Learning and Implementing</h3>
<p>As a result of attending the Velocity Conferences over the past three years, we have been able to implement the following technologies and optimizations, which have greatly impacted our efficiency at VMIX.</p>
<p><strong>Velocity 2008</strong></p>
<p>I met <a href="http://brian.moonspot.net/" target="_blank">Brian Moon</a> and <a href="http://dormando.livejournal.com" target="_blank">Alan Kasindorf (dormando)</a> and, after discussing file-system optimization, proceeded to implement some <a href="http://www.philchen.com/2009/02/09/some-tuning-tips-for-apache-mod_cache-mod_disk_cache" target="_blank">file-system tuning</a> which, in turn, helped increase our Apache Web Servers running mod_disk_cache efficiency by 3 times.</p>
<p><strong>Velocity 2009</strong></p>
<p>After several BOF (Birds of a Feather) sessions, and speaking with various attendees, I was convinced to give <a href="http://www.puppetlabs.com/puppet/introduction/" target="_blank">Puppet</a> (Configuration Management Framework) a try, along with <a href="https://fedorahosted.org/cobbler/" target="_blank">Cobbler</a> for rapid Linux installs. We&#8217;d previously used <a href="http://www.cfengine.org/" target="_blank">CFengine</a> and <a href="http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/ch-kickstart2.html" target="_blank"> Standalone Kickstart</a> and felt they were not necessarily the right tools for our operation. After proof of concept (POC), we deployed Puppet and Cobbler and are now able to build and control systems at a quicker rate, with more management and less complication.</p>
<p><strong>Velocity 2010</strong></p>
<p>I attended a talk by <a href="http://www.ogre.com/" target="_blank">Leif Hedstrom</a> on <a href="http://trafficserver.apache.org/" target="_blank">Apache Traffic Server</a> and realized it was open sourced from Yahoo to the <a href="http://apache.org" target="_blank">Apache Organization</a>. I had known about the Traffic Server back in the Inktomi days (1990&#8217;s), as well as from a company I worked for that licensed the code. However, I hadn&#8217;t realized it was openly available. After hearing that Yahoo uses the Traffic Server for their own CDN network, I decided to give it a shot and plan on using it to possibly replacing our <a href="http://www.squid-cache.org/" target="_blank">Squid</a> servers at VMIX.</p>
<p>Currently, we are running a bit of a bake-off between Squid and Apache Traffic Server, and preliminary results for Traffic Server are so favorable that, by next month, Squid might be calamari.</p>
<p>In quick closing, hopefully O&#8217;Reilly and the Velocity Program Committee keeps up the good work and my list of things learned and implemented grows!</p>
<p style="text-align: left;"><span style="color: #808080;"><em>Phil Chen is Director of Systems Engineering at VMIX.</em></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2010/07/16/velocity-the-ultimate-web-performance-and-operations-conference/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Apache Mod_Deflate and Flash SWF Files Don&#8217;t Like Each Other</title>
		<link>http://www.philchen.com/2009/08/04/apache-mod_deflate-and-flash-swf-files-dont-like-each-other</link>
		<comments>http://www.philchen.com/2009/08/04/apache-mod_deflate-and-flash-swf-files-dont-like-each-other#comments</comments>
		<pubDate>Wed, 05 Aug 2009 04:49:42 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Development 101]]></category>
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/?p=550</guid>
		<description><![CDATA[Recently I was working on a Flex project and upon completion and successful QA, I deployed it on a clients server for use. After embedding the SWF file and adding the data.xml that populated the flash application, I could not load the application in Firefox or IE. Several refreshes would load the application occasionally, however [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working on a Flex project and upon completion and successful QA, I deployed it on a clients server for use. After embedding the SWF file and adding the data.xml that populated the flash application, I could not load the application in Firefox or IE. Several refreshes would load the application occasionally, however most of the time I just had a grey box. <span id="more-550"></span></p>
<p>So while troubleshooting using Firebug, I realized that the clients server I had deployed on was using Apache 2.2.11 with Mod_Deflate enabled, a method commonly used to compress up to 70% of data transfered over the wire to speed page loads. I then had a flash back on reading an article about issues with compression of SWF&#8217;s, and upon further investigation of the clients Apache configuration file I saw SWF was not excluded from compression via Mod_Deflate.</p>
<p>Mod_Deflate was compressing SWF files sending them with chunked transfer encoding to the browser. It appears the last part of the chunk was being missed by the browser. By refreshing the browser cache it sometimes filled in the missing chunk, and displayed the application.</p>
<p>So I added SWF to the list of files not to compress via Mod_Deflate and the application worked perfectly everytime.</p>
<p>Below is the section I added the SWF exclusion:</p>
<p>BEFORE:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>Location <span style="color: #000000; font-weight: bold;">/&gt;</span>
<span style="color: #666666; font-style: italic;"># Insert filter</span>
SetOutputFilter DEFLATE
&nbsp;
<span style="color: #666666; font-style: italic;"># Netscape 4.x has some problems...</span>
BrowserMatch ^Mozilla<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span> gzip-only-text<span style="color: #000000; font-weight: bold;">/</span>html
&nbsp;
<span style="color: #666666; font-style: italic;"># Netscape 4.06-4.08 have some more problems</span>
BrowserMatch ^Mozilla<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span>\.0<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">678</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> no-gzip
&nbsp;
<span style="color: #666666; font-style: italic;"># MSIE masquerades as Netscape, but it is fine</span>
BrowserMatch \bMSIE <span style="color: #000000; font-weight: bold;">!</span>no-gzip <span style="color: #000000; font-weight: bold;">!</span>gzip-only-text<span style="color: #000000; font-weight: bold;">/</span>html
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't compress images and other uncompressible content</span>
SetEnvIfNoCase Request_URI \
 \.<span style="color: #7a0874; font-weight: bold;">&#40;</span>?:gif<span style="color: #000000; font-weight: bold;">|</span>jpe?g<span style="color: #000000; font-weight: bold;">|</span>png<span style="color: #000000; font-weight: bold;">|</span>rar<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">zip</span><span style="color: #000000; font-weight: bold;">|</span>exe<span style="color: #000000; font-weight: bold;">|</span>flv<span style="color: #000000; font-weight: bold;">|</span>mov<span style="color: #000000; font-weight: bold;">|</span>wma<span style="color: #000000; font-weight: bold;">|</span>mp3<span style="color: #000000; font-weight: bold;">|</span>avi<span style="color: #000000; font-weight: bold;">|</span>mp?g<span style="color: #7a0874; font-weight: bold;">&#41;</span>$ no-gzip dont-vary
&nbsp;
<span style="color: #666666; font-style: italic;"># Make sure proxies don't deliver the wrong content</span>
Header append Vary User-Agent <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">env</span></span>=<span style="color: #000000; font-weight: bold;">!</span>dont-vary
<span style="color: #000000; font-weight: bold;">&lt;/</span>Location<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>AFTER:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>Location <span style="color: #000000; font-weight: bold;">/&gt;</span>
<span style="color: #666666; font-style: italic;"># Insert filter</span>
SetOutputFilter DEFLATE
&nbsp;
<span style="color: #666666; font-style: italic;"># Netscape 4.x has some problems...</span>
BrowserMatch ^Mozilla<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span> gzip-only-text<span style="color: #000000; font-weight: bold;">/</span>html
&nbsp;
<span style="color: #666666; font-style: italic;"># Netscape 4.06-4.08 have some more problems</span>
BrowserMatch ^Mozilla<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span>\.0<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">678</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> no-gzip
&nbsp;
<span style="color: #666666; font-style: italic;"># MSIE masquerades as Netscape, but it is fine</span>
BrowserMatch \bMSIE <span style="color: #000000; font-weight: bold;">!</span>no-gzip <span style="color: #000000; font-weight: bold;">!</span>gzip-only-text<span style="color: #000000; font-weight: bold;">/</span>html
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't compress images and other uncompressible content</span>
SetEnvIfNoCase Request_URI \
 \.<span style="color: #7a0874; font-weight: bold;">&#40;</span>?:gif<span style="color: #000000; font-weight: bold;">|</span>jpe?g<span style="color: #000000; font-weight: bold;">|</span>png<span style="color: #000000; font-weight: bold;">|</span>rar<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">zip</span><span style="color: #000000; font-weight: bold;">|</span>exe<span style="color: #000000; font-weight: bold;">|</span>flv<span style="color: #000000; font-weight: bold;">|</span>mov<span style="color: #000000; font-weight: bold;">|</span>wma<span style="color: #000000; font-weight: bold;">|</span>mp3<span style="color: #000000; font-weight: bold;">|</span>avi<span style="color: #000000; font-weight: bold;">|</span>swf<span style="color: #000000; font-weight: bold;">|</span>mp?g<span style="color: #7a0874; font-weight: bold;">&#41;</span>$ no-gzip dont-vary
&nbsp;
<span style="color: #666666; font-style: italic;"># Make sure proxies don't deliver the wrong content</span>
Header append Vary User-Agent <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">env</span></span>=<span style="color: #000000; font-weight: bold;">!</span>dont-vary
<span style="color: #000000; font-weight: bold;">&lt;/</span>Location<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2009/08/04/apache-mod_deflate-and-flash-swf-files-dont-like-each-other/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Some Tuning Tips For Apache Mod_Cache (mod_disk_cache)</title>
		<link>http://www.philchen.com/2009/02/09/some-tuning-tips-for-apache-mod_cache-mod_disk_cache</link>
		<comments>http://www.philchen.com/2009/02/09/some-tuning-tips-for-apache-mod_cache-mod_disk_cache#comments</comments>
		<pubDate>Tue, 10 Feb 2009 06:29:05 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/?p=82</guid>
		<description><![CDATA[So this blog was quite delayed in the writing like months, but better late then never. I was tasked awhile back with creating a caching cluster serving cached API requests and during my research I selected Apache Mod_Cache and below were some things I learned  tuning it along the way.

Server Specifications:
Dell 1950&#8217;s Dual Core [...]]]></description>
			<content:encoded><![CDATA[<p>So this blog was quite delayed in the writing like months, but better late then never. I was tasked awhile back with creating a caching cluster serving cached API requests and during my research I selected Apache Mod_Cache and below were some things I learned  tuning it along the way.<br />
<span id="more-82"></span><br />
<strong>Server Specifications:</strong></p>
<p>Dell 1950&#8217;s Dual Core Intel Xeon 2.0 GHz<br />
8 Gigs of RAM<br />
Running 64bit Centos 5</p>
<p><strong>Server Application Type:</strong></p>
<p>API Caching Server</p>
<p><strong>Basic Installation:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Install Apache 2.2.8
gunzip -c httpd-2.2.8.tar.gz | tar -xvf -
cd httpd-2.2.8
./configure --disable-status --enable-status=shared --enable-rewrite --enable-so --enable-proxy --enable-cache --enable-disk-cache
make
make install</pre></div></div>

<p><strong>Installed PHP</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">gunzip -c php-5.2.8.tar.gz | tar -xvf -
cd php-5.2.8
./configure --with-apxs2=/usr/local/apache2/bin/apxs  --enable-module=so --blah --blah --blah
make
make install</pre></div></div>

<p><strong>Below is the mod_cache portion of my apache vhost:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">IfModule</span> mod_cache.c&gt;
&lt;<span style="color: #000000; font-weight:bold;">IfModule</span> mod_disk_cache.c&gt;
<span style="color: #00007f;">CacheDefaultExpire</span> <span style="color: #ff0000;">3600</span>
CacheEnable disk /
<span style="color: #00007f;">CacheRoot</span> <span style="color: #7f007f;">&quot;/opt/apicache/&quot;</span>
<span style="color: #00007f;">CacheDirLevels</span> <span style="color: #ff0000;">2</span>
<span style="color: #00007f;">CacheDirLength</span> <span style="color: #ff0000;">1</span>
CacheMaxFileSize <span style="color: #ff0000;">1000000</span>
CacheMinFileSize <span style="color: #ff0000;">1</span>
CacheIgnoreCacheControl <span style="color: #0000ff;">On</span>
CacheIgnoreNoLastMod <span style="color: #0000ff;">On</span>
CacheIgnoreQueryString <span style="color: #0000ff;">Off</span>
CacheIgnoreHeaders <span style="color: #0000ff;">None</span>
<span style="color: #00007f;">CacheLastModifiedFactor</span> <span style="color: #ff0000;">0.1</span>
<span style="color: #00007f;">CacheDefaultExpire</span> <span style="color: #ff0000;">3600</span>
<span style="color: #00007f;">CacheMaxExpire</span> <span style="color: #ff0000;">86400</span>
CacheStoreNoStore <span style="color: #0000ff;">On</span>
CacheStorePrivate <span style="color: #0000ff;">On</span>
&lt;/<span style="color: #000000; font-weight:bold;">IfModule</span>&gt;
&lt;/<span style="color: #000000; font-weight:bold;">IfModule</span>&gt;</pre></div></div>

<p>The first performance decision I made was to use &#8211;enable-disk-cache after doing some research I found that contrary to what you would think, disk cache is faster then memory cache when it comes to Apache mod_cache and OS interaction. The reason why is when you use mod_mem_cache the process of reading a file into memory, basically copying its data into RAM and thus kernel buffer in order to deliver it is not optimal. When using mod_disk_cache Linux uses the sendfile API, which does not require the server to read the file before delivering it. The server identifies the file to deliver and the destination via the API, the OS then reads and delivers the file, so no read API or memory for the payload is required, and the OS can just use the file system cache. So the kernel acts as a buffer, increasing cache speed.</p>
<p>The second performance issues I saw was when I set my CacheDirLevels and CacheDirLength to high, load was skyrocketing. I found that CacheDirLevels 2 and CacheDirLength 1 was the optimal setting for about 50 Gigs of cache, lowering the amount of traversing needed on reads and writes.</p>
<p>The third performance issue I saw was when I met <a href="http://brian.moonspot.net">Brian Moon</a> at the <a href="http://en.oreilly.com/velocity2008/public/content/home/">Velocity Conference in 2008</a> a very bright guy! I asked Brian how I could optimize the filesystem for Apache mod_disk_cache he instructed me to make some fstab changes only if I was using EXT3. Specifically to reflect the one entry below for my cache partition:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/dev/md1                /opt                    ext3   defaults,noatime,nodiratime,data=writeback 1 2</pre></div></div>

<p>Setting the noatime effects removing a write for every read. Typically when a file is read the system updates the inode for the file with an access time so that the last access time is recorded, which basically entails a write to the file system. Unless you are running some sort of mirror you probably do not need the access time written.</p>
<p>Setting the nodiratime is the same as the noatime but for directories.<br />
*Note 08/09/2009 it has been pointed out to me that noatime is a superset of nodiratime which is a subset. So if you use noatime you don&#8217;t need the entry for nodiratime</p>
<p>Setting data=writeback causes the non preserving of data ordering, the data to be written into the file system after its metadata has been committed to the journal which offers a higher throughput. Warning this setting could allow recently modified files to become corrupted in the event of an unexpected reboot or system crash.</p>
<p>If you look at the below graph you will see the sharp gain from doing the outlined tuning.</p>
<p><img src="http://www.philchen.com/wp-content/uploads/2009/02/modcache.jpg" alt="modcache" title="modcache" width="604" height="294" class="alignnone size-full wp-image-83" /></p>
<p>Happy tuning, fun stuff!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2009/02/09/some-tuning-tips-for-apache-mod_cache-mod_disk_cache/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How much can a memcached server handle?</title>
		<link>http://www.philchen.com/2008/06/18/how-much-can-a-memcached-server-handle</link>
		<comments>http://www.philchen.com/2008/06/18/how-much-can-a-memcached-server-handle#comments</comments>
		<pubDate>Thu, 19 Jun 2008 05:21:42 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/?p=49</guid>
		<description><![CDATA[Memcached is a high-performance, distributed memory object caching system. It is used in a wide range of sites such as livejournal.com and facebook.com as a way to alleviate database load helping to speed up sites. Memcached is usually deployed as an adequate subset of servers in relation to your application and database infrastructure. It&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>Memcached is a high-performance, distributed memory object caching system. It is used in a wide range of sites such as livejournal.com and facebook.com as a way to alleviate database load helping to speed up sites. Memcached is usually deployed as an adequate subset of servers in relation to your application and database infrastructure. It&#8217;s a great way to cut down your database calls by caching the requests.<br />
<span id="more-49"></span><br />
The servers are not load balanced in any least connections or response time fashion, but instead using a Hashing/Key Distribution. So in other words it spreads out cache across all the memcached servers not redundantly. A hash table allows the application to locate where cache exists. Utilizing a lazy expiration, cpu is not a factor for expiring items. An item gets requested it checks the expiration time to see if the item is still valid prior to returning it to the client. When adding a new item to the cache, if the cache is full it will look out for expired items to replace before replacing the least used items in the cache. You can read more about it at the memcached <a href="http://www.danga.com/memcached/">site</a>.</p>
<p>Recently I ran into a situation where an object (db conf) that was being called repeatedly via a web application ~100x more then any other cached item was being stored on one of four memcached servers. This item was stored as a flat file originally but had been implemented into a database which is how memcached came into play.</p>
<p>The excitement starts here, the four memcached servers were Dell 1950&#8217;s Dual Core Intel Xeon 2.0 GHz with 8 Gigs of RAM on each running Centos. Version of Memcached was 1.2.1. The particular object being cached ended up on a server as designed, however was being called by the web application a ~100x more then any other cached object and had a 5 minute expire. The particular memcached server with the object ended up taking a whopping 800+megabit/second in traffic, see the below graph:</p>
<p><img src='http://www.philchen.com/upload/memcache800mb.png' alt='memcache800mb' class='aligncenter' /><br />
*The reads and writes are reversed was the way cacti was set up.</p>
<p>The other server vitals at the time were:<br />
CPU = 60%<br />
Memcache Misses = 681 k/s<br />
Memcache Hits = 1.16 M/s<br />
Memcache Requests/sec (get&#038;set) = 1.66 million<br />
Server Load = 1.29</p>
<p>I haven&#8217;t ever had a single server reach passed 300 megabit in traffic first off so that was a new lesson of capacity and threshold. Also when memcached states it is not CPU intensive they really mean it. The server started crapping out meaning not serving requests properly at 780+megabit, so amazingly enough memcached can handle quite a lot of traffic/requests. Our switch port was saturated prior to memcached failing.</p>
<p>So lesson learned BEWARE what you cache when you are using memcached you don&#8217;t want to see the stats I did&#8230; In this case we removed that cached object which was a large DB config file and localized it. Hope this helps with giving the community a case study of memcached out in the wild.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2008/06/18/how-much-can-a-memcached-server-handle/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Effects on Performance &amp; Server Resources when using Apache 2.0 mod_status</title>
		<link>http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources</link>
		<comments>http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources#comments</comments>
		<pubDate>Mon, 02 Jun 2008 06:04:56 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources/</guid>
		<description><![CDATA[I find the Apache mod_status module to be very helpful in respect to Apache server performance/usage monitoring and debugging. However I have read books and posts stating a performance hit when the module is enabled particularly with &#8220;ExtendedStatus On&#8221;, so what&#8217;s the real deal? I never hear what the impact is, in a real world [...]]]></description>
			<content:encoded><![CDATA[<p>I find the Apache mod_status module to be very helpful in respect to Apache server performance/usage monitoring and debugging. However I have read books and posts stating a performance hit when the module is enabled particularly with &#8220;ExtendedStatus On&#8221;, so what&#8217;s the real deal? I never hear what the impact is, in a real world setting.<br />
<span id="more-48"></span></p>
<p>Let&#8217;s outline the benefits first regarding the mod_status module and what it allows you to see (Documented on Apache&#8217;s Site):</p>
<p>1) Number of children serving requests<br />
2) Number of idle children<br />
3) Status of each child, the number of requests that child has performed and the total number of bytes served by child<br />
4) Total number of accesses and byte count served<br />
5) Time the server was started/restarted and the time it has been running for<br />
6) Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request<br />
7) Current percentage CPU used by each child and in total by Apache<br />
8 ) Current hosts and requests being processed </p>
<p>*All which can be beautifully graphed using Cacti btw for historical analysis.</p>
<p>I find mod_status most useful for tuning settings when using a prefork configuration, balancing the server resources and application memory usage.</p>
<p>So the downfall of using mod_status is upon every request Apache will perform two calls to gettimeofday. These calls are done so that the status report contains timing information. The theory is that this information is taxing in retrieval and calculation.</p>
<p>So as a limited but real world test using a production server I administer, I discovered only a small impact with or without mod_status enabled.</p>
<p>The test was on a Dell 1950 Dual Core Intel Xeon 2.0 GHz 8 Gigs of RAM Linux with Apache 2.0</p>
<p>I considered server load decrease as the marker for success, in that I compiled Apache with and without mod_status and looked for differences in cpu usage, memory usage, and load stats. The Apache server in question received on average 18 requests per second, mostly API application calls through PHP. And the test lasted a week for each configuration.</p>
<p>I saw no differences even in the slightest in server memory, nor server cpu utilization. I did notice server load was on average .29 with mod_status in extended mode compiled, and average load was .20 without mod_status compiled. So a savings of .09 on average load for a server over the course of 1 week of testing with an average 18 requests per second was seen. Regarding actual http requests I saw no speed increase or decrease.</p>
<p>So my conclusion, is every little bit counts however if you find that you need to tune your Apache servers often given sporadic changes in usage, you may want to enable mod_status with extended status on and reap the benefits of graphing that data using a tool like Cacti for the greater good of tuning other aspects of Apache for a  more significant gain.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Notify me someone is logging into my Linux server</title>
		<link>http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server</link>
		<comments>http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server#comments</comments>
		<pubDate>Tue, 13 May 2008 06:16:07 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server/</guid>
		<description><![CDATA[If your like me you like to know who is logging into your servers, hopefully this blog entry will help. So the scenerio goes someone has logged into your server through means not legal or ethical at 4 AM and wants to do who knows what. It would be great to get a email notification [...]]]></description>
			<content:encoded><![CDATA[<p>If your like me you like to know who is logging into your servers, hopefully this blog entry will help. So the scenerio goes someone has logged into your server through means not legal or ethical at 4 AM and wants to do who knows what. It would be great to get a email notification to your phone and wake up to take care of business. The script below should help:</p>
<p><span id="more-47"></span></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mkdir /var/log/logins
chown youruser:youruser /var/log/logins</pre></div></div>

<p>Create the below script and place it some where permissions 755:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#The Below Directory Path is where the script will keep track of logins </span>
<span style="color: #007800;">BASE</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>logins
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># The two files below checked for a delta against each other </span>
<span style="color: #007800;">HISTORY</span>=<span style="color: #800000;">${BASE}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">history</span>
<span style="color: #007800;">CURRENT</span>=<span style="color: #800000;">${BASE}</span><span style="color: #000000; font-weight: bold;">/</span>current
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Failure Function</span>
fail<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Failed: $*&quot;</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Function to clean output from the last command</span>
clean_last<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">last</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'{
 /^reboot /d
/^$/d
/^wtmp begins /d
}'</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #007800;">MYGROUP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">id</span> -gn<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">MYIDENT</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">id</span> -un<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Checking the env or error</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${BASE}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #800000;">${BASE}</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${BASE}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> fail could not create <span style="color: #800000;">${BASE}</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-G</span> <span style="color: #800000;">${BASE}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> fail <span style="color: #800000;">${BASE}</span> not owned by <span style="color: #800000;">${MYGROUP}</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-O</span> <span style="color: #800000;">${BASE}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> fail <span style="color: #800000;">${BASE}</span> not owned by <span style="color: #800000;">${MYIDENT}</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Store current info</span>
clean_last <span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #800000;">${CURRENT}</span>
<span style="color: #666666; font-style: italic;"># Is there a history file?</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #800000;">${HISTORY}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cmp</span> <span style="color: #660033;">--silent</span> <span style="color: #007800;">$CURRENT</span> <span style="color: #007800;">$HISTORY</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #666666; font-style: italic;"># Yes mail someone</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #007800;">$HISTORY</span> <span style="color: #007800;">$CURRENT</span> <span style="color: #000000; font-weight: bold;">|</span>mail youremail<span style="color: #000000; font-weight: bold;">@</span>whatever.com <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;Login report&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Make current history</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #800000;">${CURRENT}</span> <span style="color: #800000;">${HISTORY}</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> fail <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #800000;">${CURRENT}</span> <span style="color: #800000;">${HISTORY}</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#END OF SCRIPT</span></pre></div></div>

<p>Create a crontab for your user to run the script:</p>
<p>*/5 * * * * /path/to/my/script/checklogin.sh</p>
<p>This should do it, gives a little more comfort, but I still recommend your typical safe guards IPTABLES, SNORT, etc&#8230; best practices.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Helpful BASH Shell Command Prompts</title>
		<link>http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts</link>
		<comments>http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts#comments</comments>
		<pubDate>Sat, 28 Jul 2007 23:57:30 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts/</guid>
		<description><![CDATA[Here are some helpful tips on altering your BASH command prompt. Info in your command prompt can improve your work productivity and also prevent you from doing the wrong thing at the wrong place.

Add one of the below entries into your .bashrc file
vi ~/.bashrc
then activate your changes by sourcing it
source ~/.bashrc
1) To display the username, short version of hostname, [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some helpful tips on altering your BASH command prompt. Info in your command prompt can improve your work productivity and also prevent you from doing the wrong thing at the wrong place.<br />
<span id="more-43"></span><br />
<strong>Add one of the below entries into your .bashrc file</strong></p>
<p>vi ~/.bashrc</p>
<p><strong>then activate your changes by sourcing it</strong></p>
<p>source ~/.bashrc</p>
<p><strong>1) To display the username, short version of hostname, and the current working directory (light blue)</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'\[\033[1;34m\][\u@\h:\w]\$\[\033[0m\]'</span></pre></div></div>

<p><strong>Output:<br />
</strong><br />
[phil@server1:/usr/local/bin]$</p>
<p><strong>2) To display username, short version of hostname, date, time, and the current working directory</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'[\u@\h \d \A] \w \$ '</span></pre></div></div>

<p><strong>Output:</strong></p>
<p>[phil@server1 Sat Jul 28 15:44] /usr/local/lib $</p>
<p><strong>3) To display new line, username, short version hostname, base PTY, shell level, history number, new line, and the current working directory</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'\n[\u@\h \l:$SHLVL:\!]\n$PWD\$ '</span></pre></div></div>

<p><strong>Output:<br />
</strong><br />
[phil@server1 0:1:123]<br />
/usr/local/bin$</p>
<p><strong>4) To display, username, short version hostname, number of jobs in the background a new line and working path</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'\n[\u@\h jobs:\j]\n$PWD\$ '</span></pre></div></div>

<p><strong>Output:</strong></p>
<p>[phil@server1 jobs:0]<br />
/usr/local/bin$</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Enable Passwordless Authentication with SSH</title>
		<link>http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh</link>
		<comments>http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh#comments</comments>
		<pubDate>Sat, 28 Jul 2007 22:12:51 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh/</guid>
		<description><![CDATA[Often times you have automated scripts that require access to multiple machines from a single source and need to do so without having to deal with ssh password prompts. And in other instances you may have a bastian host (strong point) security model which you would like to have passwordless communication from. Below are 10 [...]]]></description>
			<content:encoded><![CDATA[<p>Often times you have automated scripts that require access to multiple machines from a single source and need to do so without having to deal with ssh password prompts. And in other instances you may have a bastian host (strong point) security model which you would like to have passwordless communication from. Below are 10 steps to setting up passwordless authentication with SSH in Linux.<br />
<span id="more-42"></span><br />
<strong>Step 1:<br />
</strong>(*note server1 is the source server and server2 will be the destination server)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server1# mkdir ~/.ssh</pre></div></div>

<p><strong>Step 2:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server1# cd ~/.ssh</pre></div></div>

<p><strong>Step 3:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server1# ssh-keygen -t rsa</pre></div></div>

<p><em>Generating public/private rsa key pair.<br />
Enter file in which to save the key (&#8220;your_local_home&#8221;/.ssh/id_rsa):<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in id_rsa.<br />
Your public key has been saved in id_rsa.pub.<br />
The key fingerprint is:<br />
18:6a:e3:78:ab:2d:0c:8e:f9:67:f7:30:32:44:77:34 phil@server1</em></p>
<p><strong>Step 4:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server1# scp ~/.ssh/id_rsa.pub phil@server2.philchen.com:/home/phil/id_rsa.server1.pub</pre></div></div>

<p><strong>Step 5:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server1# ssh phil@server2.philchen.com
Password:</pre></div></div>

<p><strong>Step 6:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server2# mkdir .ssh</pre></div></div>

<p><strong>Step 7:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server2# chmod 700 .ssh</pre></div></div>

<p><strong>Step 8:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server2# cat id_rsa.server1.pub &gt;&gt; .ssh/authorized_keys</pre></div></div>

<p><strong>Step 9:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server2# chmod 644 .ssh/authorized_keys</pre></div></div>

<p><strong>Step 10:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server2# exit
server1# ssh phil@server2.philchen.com</pre></div></div>

<p>*Note repeat steps 4-10 for all target servers you would like passwordless access from server1</p>
<p>* FYI Ensure your /home/user directory has the permission 755 also!</p>
<p>You should be all set!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configuring MCrypt Support For Mod_PHP</title>
		<link>http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php</link>
		<comments>http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php#comments</comments>
		<pubDate>Mon, 11 Jun 2007 19:48:43 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php/</guid>
		<description><![CDATA[MCrypt is a replacement for older crypt() package and crypt(1) command with extensions. It allows developers encryption functions, specifically allowing users to encrypt files or data streams.
Configuring MCrypt support for Mod_PHP can be a pain so hopefully this article will help!

The below was tested on a Centos  4.4  64 Bit server.
Package Dependencies:

libmcrypt-2.5.8.tar.gz
mhash-0.9.9
mcrypt-2.6.4
php-5.2.1.tar.gz
Installation Notes:
libmcrypt:


gunzip [...]]]></description>
			<content:encoded><![CDATA[<p>MCrypt is a replacement for older crypt() package and crypt(1) command with extensions. It allows developers encryption functions, specifically allowing users to encrypt files or data streams.</p>
<p>Configuring MCrypt support for Mod_PHP can be a pain so hopefully this article will help!<br />
<span id="more-41"></span><br />
The below was tested on a Centos  4.4  64 Bit server.</p>
<p><strong>Package Dependencies:<br />
</strong><br />
libmcrypt-2.5.8.tar.gz<br />
mhash-0.9.9<br />
mcrypt-2.6.4<br />
php-5.2.1.tar.gz</p>
<p><strong>Installation Notes:</strong></p>
<p><strong>libmcrypt:<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">gunzip -c libmcrypt-2.5.8.tar.gz | tar xf -
cd libmcrypt-xxx
./configure --disable-posix-threads
make
make check  (note:  'make check' is optional)
make install
added /usr/local/lib to ld.so.conf
ldconfig or LD_LIBRARY_PATH=/usr/local/lib
(Below is important)
cd libmcrypt-2.5.8/libltdl
./configure --enable-ltdl-install
make
make install</pre></div></div>

<p><strong>mhash:<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ldconfig
gunzip -c mhash-0.9.9.tar.gz | tar xf -
cd mhash-xxx
./configure
make
make check   (note:  'make check' is optional)
make install</pre></div></div>

<p><strong>mcrypt:<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ldconfig
gunzip -c mcrypt-2.6.4.tar.gz | tar xf -
cd mcrypt
./configure
make
make check   (note:  'make check' is optional)
make install</pre></div></div>

<p><strong>PHP:<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">gunzip -c php-5.2.1.tar.gz | tar xf -
./configure --with-apxs2=/usr/sbin/apxs  --with-jpeg-dir=lib64
--BLAH --BLAH --BLAH --with-mcrypt=/path/to/mcrypt-2.6.4
(*NOTE the path of --with-mcrypt= install directory source code)
make
make install</pre></div></div>

<p>This should get you up and running to use mcrypt!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Quick and Dirty How To Write an Init Script</title>
		<link>http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script</link>
		<comments>http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script#comments</comments>
		<pubDate>Mon, 04 Jun 2007 23:44:35 +0000</pubDate>
		<dc:creator>Phil Chen</dc:creator>
				<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script/</guid>
		<description><![CDATA[Often times you may have an application that needs to be boot strapped or started automatically via an Init script. Below is a quick and dirty sample Init script to help you get on your way. Also the the article will cover chkconfig options to start the script at the correct run level.

The script will [...]]]></description>
			<content:encoded><![CDATA[<p>Often times you may have an application that needs to be boot strapped or started automatically via an Init script. Below is a quick and dirty sample Init script to help you get on your way. Also the the article will cover chkconfig options to start the script at the correct run level.<br />
<span id="more-40"></span><br />
The script will reside in /etc/init.d/BLAH</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># SAMPLE BASIC INIT SCRIPT</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Below is the chkconfig syntax for auto startup at different run levels</span>
<span style="color: #666666; font-style: italic;"># Note runlevel 1 2 and 3, 69 is the Start order and 68 is the Stop order</span>
<span style="color: #666666; font-style: italic;"># Make sure these are unique by looking into /etc/rc.d/*</span>
<span style="color: #666666; font-style: italic;"># Also below is the description which is necessary.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># chkconfig: 123 69 68</span>
<span style="color: #666666; font-style: italic;"># description: Description of the Service</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Below is the source function library</span>
<span style="color: #666666; font-style: italic;">#</span>
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>functions
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>BLAH <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>BLAH
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Below is the Script Goodness controlling the service</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Start service BLAH&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>BLAH start
<span style="color: #000000; font-weight: bold;">;;</span>
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Stop service BLAH&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>BLAH stop
<span style="color: #000000; font-weight: bold;">;;</span>
restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Restart service BLAH&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>BLAH restart
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart}&quot;</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

<p>Now to run chkconfig commands:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">bash-3.00$ chkconfig BLAH --add</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">bash-3.00$ chkconfig BLAH on</pre></div></div>

<p>The above will read the Init script and add and enable the script at the proper run level<br />
specified in the script. Appending the start command on boot.</p>
<p>You could also do the below to be more specific in which run level to enable:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">bash-3.00$  chkconfig --level 123 BLAH on (to turn on at run level 1 2 3)</pre></div></div>

<p>or</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">bash-3.00$ chkconfig --level 123 BLAH off (to turn off at run level 1 2 3)</pre></div></div>

<p>To list all run:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">bash-3.00$ chkconfig --list</pre></div></div>

<p>This should be a quick and dirty to get you going.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
