<?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>UNIXy &#187; UNIXy</title>
	<atom:link href="http://blog.unixy.net/author/UNIXy/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.unixy.net</link>
	<description>Truly Fully Managed Servers</description>
	<lastBuildDate>Thu, 29 Jul 2010 13:13:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>What is a fully managed dedicated server or hosting?</title>
		<link>http://blog.unixy.net/2010/07/what-is-a-fully-managed-dedicated-server-or-hosting/</link>
		<comments>http://blog.unixy.net/2010/07/what-is-a-fully-managed-dedicated-server-or-hosting/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 19:14:01 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[dedicated hosting]]></category>
		<category><![CDATA[dedicated server]]></category>
		<category><![CDATA[fully managed server]]></category>
		<category><![CDATA[managed dedicated server]]></category>
		<category><![CDATA[managed hosting]]></category>
		<category><![CDATA[managed server]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=415</guid>
		<description><![CDATA[In this post, we will explain what a dedicated server is and the difference between a managed dedicated server and a fully managed dedicated server.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F07%2Fwhat-is-a-fully-managed-dedicated-server-or-hosting%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F07%2Fwhat-is-a-fully-managed-dedicated-server-or-hosting%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this post, we will explain what a dedicated server is and the differences between a managed dedicated server and a fully managed dedicated server. At the expense of confusing you, a managed server being offered at Company A might not feature the same service level as a managed server offered at Company B. Why so? Read on to find out.</p>
<p>Before we delve into the differences, know that <a title="Fully Managed Dedicated Servers and Clusters" href="http://www.unixy.net">UNIXY</a> (http://www.unixy.net) is a fully managed dedicated server hosting provider. We clearly state that our Linux server management service covers everything one would ever need. Our management philosophy is unambiguous: if you cannot complete a task with a few mouse clicks, UNIXY will gladly do. We secure, optimize, and monitor your server at all times throughout the year. We are always happy to help our clients and give them the support they need to thrive and stay worry-free.</p>
<ul>
<li><strong>What is a server?</strong></li>
</ul>
<p>First things first, a server is a specialized computer that is installed at a private facility called a data center. The lingo used in the hosting business for &#8220;installed&#8221; is racked up. A data center is a private building built to withstand harsh environmental conditions, secured to fend off any kind of physical intrusion, configured with redundancy at the network and power grid level, and staffed with technicians, engineers, and security officers. Data centers are generally boring from the outside but very interesting in the inside. They sport state-of-the-art equipment and technology. The picture below is of a Google data center.<br />
<br />
<div id="attachment_438" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.unixy.net/wp-content/uploads/2010/07/google-dc.jpg"><img class="size-medium wp-image-438" title="Outside View of a Datacenter" src="http://blog.unixy.net/wp-content/uploads/2010/07/google-dc-300x225.jpg" alt="Outside View of a Datacenter" width="300" height="225" /></a><p class="wp-caption-text">Outside View of a Data Center</p></div><br />
</p>
<ul>
<li><strong>What is a dedicated server?</strong></li>
</ul>
<p>A dedicated server is a computer server that is racked up and configured to handle the requirements of an individual or an entity. It is said to be dedicated because its resources are not shared with any other entity. They are dedicated. At a bare minimum, the provider is required to install an operating system like Linux and replace any hardware component that fails while you are renting the dedicated server. This means that if your hard drive has a defect, you are entitled to a speedy replacement at no charge to you. The same applies to the network. Should you notice network connectivity issues, your provider is required to investigate and identify the root cause, again, at no charge to you.<br />
<br />
<div id="attachment_442" class="wp-caption aligncenter" style="width: 250px"><a href="http://blog.unixy.net/wp-content/uploads/2010/07/server_cabinet.jpg"><img class="size-full wp-image-442" title="Server Cabinet Inside a Data Center" src="http://blog.unixy.net/wp-content/uploads/2010/07/server_cabinet.jpg" alt="Server Cabinet Inside a Data Center" width="240" height="218" /></a><p class="wp-caption-text">Server Cabinet Inside a Data Center</p></div><br />
<br />
It is common to install a Web control panel, which is a software application that one can access via the browser to manage and control the server, add websites and email accounts, and just about anything one can imagine. There are several control panels in the market each with its advantages and learning curve. Some are free and others cost money. The cost of such control panel can range from $15 to $40 per month. cPanel (http://www.cpanel.net) is a one such control panel for Linux. DirectAdmin (http://www.directadmin.com) is another.</p>
<ul>
<li><strong>Is a control panel enough to manage a server?</strong></li>
</ul>
<p>Keep in mind that while a control panel is convenient and practical, one still needs trained engineers and technicians to maintain the back-end of the system. This is where server management comes in. At a bare minimum, server management should include system patching (software fixes and upgrades), system security enforcement to prevent compromises, and trouble shooting. So a control panel is a step forward in the right direction but is not all encompassing.</p>
<ul>
<li><strong>What is a managed dedicated server?</strong></li>
</ul>
<p>A managed dedicated server is a dedicated server that comes with a certain level of support from the provider. Software upgrades and patching is provided for free. Software crash root cause remediation is also covered. The security of the server is assumed by the provider. Should you need help with installing common software on the server, that will also get taken care of. That includes a Web server software anddatabase software. The provider expects you to have a certain technical knowledge and understanding so you can navigate around the system. For example, they expect you to know how to add email accounts, add Web sites, transfer your content via FTP, and generally have a basic understanding of Web hosting.</p>
<ul>
<li><strong>What is a fully managed dedicated server?</strong></li>
</ul>
<p>This is the creme of the crop of all management plans. If you rent a fully managed dedicated server, you, as a customer, are not to be concerned with anything beyond updating your Web content and running your business. Full management means that regardless of the request, the provider will complete it for you. Keep in mind that software development or software bug fix requests are not covered under this level. Those requests are meant to be handled by a software development firm.</p>
<ul>
<li><strong>Server management is perceived differently</strong></li>
</ul>
<p>Server management tasks are not industry standard so there is ambiguity as to what plan covers what exactly. Some managed providers refuse to complete a certain request because the software is not covered. Others charge for the labor required to complete the task. As a consumer, it is always recommended to approach the provider, before signing up, and ask for what is or what is not covered by the managed service. Keeping a record of such conversation can protect you should you be in a such situation.</p>
<p>That&#8217;s all folks! This concludes our article on server management. I hope you enjoyed it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2010/07/what-is-a-fully-managed-dedicated-server-or-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to build your own CDN using BIND, GeoIP, Nginx, and Varnish</title>
		<link>http://blog.unixy.net/2010/07/how-to-build-your-own-cdn-using-bind-geoip-nginx-and-varnish/</link>
		<comments>http://blog.unixy.net/2010/07/how-to-build-your-own-cdn-using-bind-geoip-nginx-and-varnish/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 18:40:51 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Challenge]]></category>
		<category><![CDATA[akamai]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[CDN]]></category>
		<category><![CDATA[geodns]]></category>
		<category><![CDATA[GeoIP]]></category>
		<category><![CDATA[global CDN]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[own CDN]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[private CDN]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=342</guid>
		<description><![CDATA[In this article, we shall outline the steps required to build a private Content Delivery or Distribution Network (CDN) using Varnish Cache, Nginx, BIND, and GeoIP. The goal is to build a CDN using free, readily available software but most importantly spend the least amount of funds possible. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F07%2Fhow-to-build-your-own-cdn-using-bind-geoip-nginx-and-varnish%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F07%2Fhow-to-build-your-own-cdn-using-bind-geoip-nginx-and-varnish%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this article, we shall outline the steps required to build a private Content Delivery or Distribution Network (CDN) using Varnish Cache and Nginx. The goal is to build a CDN using free, readily available software but most importantly spend the least amount of funds possible. To this end, all nodes participating in this network are going to be virtual machines (Xen, Virtuozzo, OpenVZ, etc). Should you have any questions or comments on the configuration of this CDN, please post them in this forum: <a title="Varnish Cache Forum" href="http://www.varnish-cache.info/" target="_blank">http://www.varnish-cache.info/</a></p>
<p>Our global CDN can not only keep the latest copy of static files closer to our global visitors but can also cache the most used pages (dynamic or not) in memory on the edge nodes! This means less trips to the geographically distant and slower Dynamic Node (see below). This is similar to what Akamai and other well known firms do, only at a fraction of the cost. However, in this article, and to keep things simple, we will only be caching static files.</p>
<p>Some of you might be surprised to learn that we built this global CDN free of charge for one of our beloved customers. UNIXY offers truly fully managed dedicated servers and clusters. Our motto is simple: what you cannot do with a few mouse clicks, we will gladly do it for you! Please visit us online when you have a chance: <a title="Truly Fully Managed Dedicated Servers" href="http://www.unixy.net" target="_self">http://www.unixy.net</a>. Please do ask if you have any question or comment. No question is minor!</p>
<div style="margin-bottom:20px;"></div>
<ul>
<li><strong>The Big Picture</strong></li>
</ul>
<p>The illustration below presents a logical layout of our CDN. Edge nodes can be located just about anywhere in the world. One could also add more nodes at any location should there be a capacity need. The Dynamic Content Node will typically run a mixture of MySQL, Apache, and server-side software built using PHP, Ruby, Python, .Net, or any language for that matter.</p>
<p><strong> </strong></p>
<div id="attachment_344" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.unixy.net/wp-content/uploads/2010/07/CDN_design.png"><img class="size-medium wp-image-344" title="Global CDN Logical Design" src="http://blog.unixy.net/wp-content/uploads/2010/07/CDN_design-300x273.png" alt="Global CDN" width="300" height="273" /></a><p class="wp-caption-text">Global CDN</p></div>
<p><strong> </strong></p>
<p><strong> </strong></p>
<ol><strong><span style="font-weight: normal;"><br />
</span></strong></ol>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong></p>
<ul>
<li>Role of Each Software Component</li>
</ul>
<p></strong></p>
<p>Nginx is a lightweight high-performance Web server that is able to handle large traffic consistently. We are leveraging its proxy and caching capabilities. We shall compile Nginx and leverage the proxy module. This module allows us to cache data on the local disks of the remote edge locations.</p>
<p>As its name implies, Varnish Cache is a high-performance caching engine used to keep recently accessed content in memory for fastest access. Varnish is not a Web server. Hence our need to bundle it with Nginx, which is acting as a Web server at the edge nodes. We will cover Varnish in detail in our next installment.</p>
<p>And finally the glue that holds all of these components together: BIND. BIND is the DNS software used to map Internet host names to IP addresses. We shall patch Bind to add geographical filters support. In other words, BIND will serve each client the IP of closest edge node in the CDN. For example, an vistor from Africa will receive the edge node IP of South Africa or Morocco depending on the filters. We will touch on this later.</p>
<div style="margin-bottom:20px;"></div>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong></p>
<ul>
<li>Node Layout</li>
</ul>
<p></strong></p>
<p>At a minimum, we will need two nodes to demo and build our private CDN. That&#8217;s one Dynamic Content Node and one Edge Location node. The Dynamic Content Node will run the full LAMP stack along with BIND and the geographical filters patch. The Edge Location node will run Nginx and Varnish. One could always run BIND+GeoIP on a separate node as it is good practice. We will assign the hostname dynamic_content to the Dynamic Content Node and edge_node to the Edge Location.</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong></p>
<ul>
<li>Installation and configuration</li>
</ul>
<p></strong></p>
<p>Download BIND from ISC: <a href="http://www.bind9.net/download">http://www.bind9.net/download</a></p>
<p>Download MaxMind&#8217;s C API: <a href="http://geolite.maxmind.com/download/geoip/api/c/">http://geolite.maxmind.com/download/geoip/api/c/</a></p>
<blockquote>
<div id="_mcePaste">[root@dynamic_node /]# cd /usr/src/</div>
<div id="_mcePaste">[root@dynamic_node src]# wget http://mirrors.24-7-solutions.net/pub/isc/bind9/9.2.4/bind-9.2.4.tar.gz</div>
<div>[root@dynamic_node src]# wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz</div>
<div>[root@dynamic_node src]# tar -xzvf bind-9.2.4.tar.gz</div>
<div>[root@dynamic_node src]# tar -xzvf GeoIP-1.4.6.tar.gz</div>
<div>[root@dynamic_node src]# cd GeoIP-1.4.6</div>
<div>[root@dynamic_node GeoIP-1.4.6]# ./configure &#8211;prefix=/usr/local/geoip</div>
<div>[root@dynamic_node GeoIP-1.4.6]# make</div>
<div>[root@dynamic_node GeoIP-1.4.6]# make install</div>
<div>[root@dynamic_node GeoIP-1.4.6]# cd ..</div>
<div>
<div>[root@dynamic_node src]# patch -p0 &lt; bind-9.2.4-geodns-patch/patch.diff</div>
<div>[root@dynamic_node src]# cd bind-9.2.4</div>
<div>[root@dynamic_node bind-9.2.4]# CFLAGS=&#8221;-I/usr/local/geoip/include&#8221; LDFLAGS=&#8221;-L/usr/local/geoip/lib -lGeoIP&#8221; ./configure &#8211;prefix=/usr/local/bind</div>
<div>[root@dynamic_node bind-9.2.4]# make</div>
<div>[root@dynamic_node bind-9.2.4]# make install</div>
</div>
</blockquote>
<div style="margin-top:20px;"></div>
<div>Bind-GeoIP comes with a named.conf file with examples on how to use filtering. Setup your zone files and test them accordingly. The GeoIP patch official page has instructions and examples. Be sure to read over it should you need help: <a href="http://www.caraytech.com/geodns/">http://www.caraytech.com/geodns/</a>. If you do not have access to nodes in the different geo locations around the world to test your BIND configuration, http://traceroute.org is a good resource to leverage. It allows one to test DNS resolution using a looking glass (ping).</div>
<div style="margin-top:20px;"></div>
<div>Here is how the filters should look inside named.conf:</div>
<div style="margin-bottom:20px;"></div>
<div>
<blockquote>
<div>view &#8220;us&#8221; {</div>
<div>// Match clients from US &amp; Canada</div>
<div>match-clients { country_US; country_CA; };</div>
<div>// Provide recursive service to internal clients only.</div>
<div>recursion no;</div>
<div>zone &#8220;cdn.unixy.net&#8221; {</div>
<div>type master;</div>
<div>file &#8220;pri/unixy-us.db&#8221;;</div>
<div>};</div>
<div>zone &#8220;.&#8221; IN {</div>
<div>type hint;</div>
<div>file &#8220;named.ca&#8221;;</div>
<div>};</div>
<div>};</div>
<div>view &#8220;latin&#8221; {</div>
<div>// Match from Argentina, Chile and Brazil</div>
<div>match-clients { country_AR; country_CL; country_BR; };</div>
<div>// Provide recursive service to internal clients only.</div>
<div>recursion no;</div>
<div>zone &#8220;cdn.unixy.net&#8221; {</div>
<div>type master;</div>
<div>file &#8220;pri/unixy-latin.db&#8221;;</div>
<div>};</div>
<div>zone &#8220;.&#8221; IN {</div>
<div>type hint;</div>
<div>file &#8220;named.ca&#8221;;</div>
<div>};</div>
<div>};</div>
</blockquote>
</div>
<div style="margin-top:20px;"></div>
<div>Let us move on now and install Nginx and Varnish.</div>
<div style="margin-bottom:20px;"></div>
<blockquote>
<div>[root@edge_node src]# wget http://nginx.org/download/nginx-0.8.45.tar.gz</div>
<div>[root@edge_node src]# tar -xzvf nginx-0.8.45.tar.gz</div>
<div>[root@edge_node src]# cd nginx-0.8.45</div>
<div>[root@edge_node nginx-0.8.45]# ./configure &#8211;prefix=/usr/local/nginx &#8211;with-http_realip_module</div>
<div>[root@edge_node nginx-0.8.45]# make</div>
<div>[root@edge_node nginx-0.8.45]# make install</div>
</blockquote>
<div style="margin-top:20px;"></div>
<div>Here is our nginx.conf file with relevant lines only. All other configuration options are stock Nginx:</div>
<div style="margin-bottom:20px;"></div>
<p><code> </code></p>
<div>
<p><code> </code></p>
</div>
<blockquote>
<div>http {</div>
<div>include       mime.types;</div>
<div>default_type  application/octet-stream;</div>
<div>sendfile        on;</div>
<div>keepalive_timeout  65;</div>
<div>upstream dynamic_node {</div>
<div style="padding-left: 30px;">server 1.1.1.1:80; # 1.1.1.1 is the IP of the Dynamic Node</div>
<div>}</div>
<div>server {</div>
<div>listen       81;</div>
<div>server_name  cdn.unixy.net;</div>
<div>location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css|mp3|swf|ico|flv)$ {</div>
<div>proxy_set_header  X-Real-IP  $remote_addr;</div>
<div><strong>proxy_pass http://dynamic_node;</strong></div>
<div><strong>proxy_store /var/www/cache$uri;</strong></div>
<div><strong>proxy_store_access user:rw group:rw all:r;</strong></div>
<div>}</div>
</blockquote>
<div style="margin-top:20px;"></div>
<div>In bold above are configuration lines that are key and define our private CDN. The upstream is essentially going to be our Dynamic Node to which we pass requests that cannot be served from cache. Also, Nginx will only be caching static files like GIF, PNG, and JS. Varnish on the other hand will be caching dynamic pages. Notice how Nginx listens on port 81. This is because Varnish will listen on port 80 and will forward requests to Nginx on port 80. More on Varnish later.</div>
<div>Notice how we are using cdn.unixy.net as the handle for our virtual host name. It can be just about anything depending on your configuration. Once the cache builds up, you should start seeing files and directories being populated under /var/www/ as instructed above.</div>
<div>
<div style="margin-top:20px;"></div>
<p>A few seconds of browsing and the disk cache is already populating:
</p></div>
<div style="margin-bottom:20px;"></div>
<div>
<blockquote><p>[root@edge_node /]# ls -al /var/www/cache<br />
contact-unixy  css  images  index.html  javascript  js<br />
[root@edge_node /]# </p></blockquote>
</div>
<div style="margin-top:20px;"></div>
<div>Next we will proceed with installing Varnish. Varnish will act an in-memory cache. While it is not necessary, it can improve response time greatly. Nonetheless, installing Varnish does add a level of complexity to our configuration.</div>
<div style="margin-bottom:20px;"></div>
<blockquote>
<div>[root@edge_node src]# wget http://downloads.sourceforge.net/project/varnish/varnish/2.1.2/varnish-2.1.2.tar.gz?use_mirror=cdnetworks-us-1&amp;ts=1279434397</div>
<div>[root@edge_node src]# tar -xzvf varnish-2.1.2.tar.gz</div>
<div>[root@edge_node src]# tar -xzvf varnish-2.1.2.tar.gz</div>
<div>[root@edge_node varnish-2.1.2]# ./configure &#8211;prefix=/usr/local/varnish</div>
<div>[root@edge_node varnish-2.1.2]# make</div>
<div>[root@edge_node varnish-2.1.2]# make install</div>
</blockquote>
<div style="margin-top:20px;"></div>
<div>Be sure to follow guides online on the initial setup of Varnish. This article only covers the configuration of the CDN. There are certainly additional Varnish options that need tuning but those are most likely peculiar to your application.</div>
<div style="margin-bottom:20px;"></div>
<div>
<blockquote>
<div>backend default {</div>
<div style="padding-left: 30px;">.host = &#8220;127.0.0.1&#8243;;</div>
<div style="padding-left: 30px;">.port = &#8220;81&#8243;;</div>
<div>}</div>
</blockquote>
</div>
<div>
<blockquote>
<div>sub vcl_recv {</div>
<div style="padding-left: 30px;">
.<br />
.<br />
.<br />
if (req.url ~ &#8220;\.(js|css|jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf)$&#8221;) {</div>
<div style="padding-left: 60px;">return (lookup);</div>
<div style="padding-left: 30px;">}<br />
.<br />
.<br />
.
</div>
<div>
}
</div>
</blockquote>
<blockquote>
<div>sub vcl_fetch {</div>
<div style="padding-left: 30px;">
.<br />
.<br />
.<br />
if (req.url ~ &#8220;\.(js|css|jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf)$&#8221;) {</div>
<div style="padding-left: 60px;">unset obj.http.set-cookie;</div>
<div style="padding-left: 30px;">
}<br />
.<br />
.<br />
.
</div>
<div>
}</div>
</blockquote>
<div style="margin-top:20px;"></div>
<div>Go ahead and startup Varnish and browse around you portal a bit to build the cache. Monitor the command varnishstat on the edge node and you will be able to see the cache hits and misses. There should be more hits as the cache builds up over time and more objects are accessed.</div>
<div style="margin-bottom:30px;"></div>
</div>
<div><strong></p>
<ul>
<li>Wrap up</li>
</ul>
<p></strong><strong><span style="font-weight: normal;">The instructions above can replicated across however many additional Edge Nodes you want to add. One could also add redundancy to the BIND+GeoIP setup by configuring secondary nodes. The illustration below shows the flow of a request from top to bottom.</span><br />
</strong></p>
<div style="margin-top:40px;"></div>
<div>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong></p>
<div id="attachment_389" class="wp-caption aligncenter" style="width: 437px"><a href="http://blog.unixy.net/wp-content/uploads/2010/07/text3648.png"><img class="size-medium wp-image-389 " title="CDN Request and Response Flow" src="http://blog.unixy.net/wp-content/uploads/2010/07/text3648-300x237.png" alt="CDN Built Using Nginx and Varnish" width="427" height="338" /></a><p class="wp-caption-text">CDN Request and Response Flow</p></div>
<div style="margin-top:30px;"></div>
<p></strong>That&#8217;s all folks! I hope you enjoyed this article.</p>
<div style="margin-bottom:20px;"></div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2010/07/how-to-build-your-own-cdn-using-bind-geoip-nginx-and-varnish/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to train SpamAssassin&#8217;s Bayesian filter on spam or ham</title>
		<link>http://blog.unixy.net/2010/06/how-to-train-spamassassins-bayesian-filter-on-spam-or-ham/</link>
		<comments>http://blog.unixy.net/2010/06/how-to-train-spamassassins-bayesian-filter-on-spam-or-ham/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 16:27:49 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Crash Course]]></category>
		<category><![CDATA[bayesian]]></category>
		<category><![CDATA[classifier]]></category>
		<category><![CDATA[ham]]></category>
		<category><![CDATA[mailbox]]></category>
		<category><![CDATA[maildir]]></category>
		<category><![CDATA[SA]]></category>
		<category><![CDATA[sa-learn]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spamassassin]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=324</guid>
		<description><![CDATA[SpamAssassin (SA) is a program used for email spam filtering based on content matching rules. The Bayesian classifier that comes with SpamAssassin can be trained to recognize spam (or ham) based on a few sample emails. SA breaks the spam email into tokens or group of tokens for processing. Once SA is fed a large [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F06%2Fhow-to-train-spamassassins-bayesian-filter-on-spam-or-ham%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F06%2Fhow-to-train-spamassassins-bayesian-filter-on-spam-or-ham%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>SpamAssassin (SA) is a program used for email spam filtering based on content matching rules. The Bayesian classifier that comes with SpamAssassin can be trained to recognize spam (or ham) based on a few sample emails. SA breaks the spam email into tokens or group of tokens for processing. Once SA is fed a large enough sample of spam tokens, it will start marking spam email with a higher score and thus block the spam. The same applies to ham except that the score is lower.</p>
<p>The sa-learn utility that comes with SA is the tool used to train SA on what is spam or what is ham. It is crucial to feed sa-learn with either spam or ham and not both at the same time. While sa-learn has several command line switches for various options, one only needs a couple of flags to have it process emails. The following two command lines are all one needs to get the job done:</p>
<p>To train SA on spam, run the following from the server in question:</p>
<blockquote><p><strong><code>sa-learn --showdots --mbox --spam spam-file</code></strong></p></blockquote>
<p>To train SA on ham, run the following from the server in question:</p>
<blockquote><p><strong><strong><code>sa-learn --showdots --mbox --ham ham-file</code></strong></strong></p></blockquote>
<p><em>spam-file</em> and <em>ham-file</em> are files in Mailbox format. So what if your inbox is of type Maildir? There is an extra step involved in converting the Maildir format to a Mailbox. The utility <em><a title="Mailbox to Maildir tool" href="http://batleth.sapienti-sat.org/projects/mb2md/">mb2md</a> </em>can do the job seamlessly. Once the Maildir is converted to Mailbox, simply replace &#8216;spam-file&#8217; in the command line above with the resulting Mailbox file from the conversion.</p>
<p><em><span style="font-style: normal;">That&#8217;s all folks! We hope this was useful.</span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2010/06/how-to-train-spamassassins-bayesian-filter-on-spam-or-ham/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick &amp; dirty Varnish monitoring script</title>
		<link>http://blog.unixy.net/2010/05/dirty-varnish-monitoring-script/</link>
		<comments>http://blog.unixy.net/2010/05/dirty-varnish-monitoring-script/#comments</comments>
		<pubDate>Thu, 27 May 2010 04:56:25 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Break-Fix]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[restart]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=311</guid>
		<description><![CDATA[Depending on which version of Varnish you have running, there is a chance the code is still experimental and the whole Varnish daemon is prone to a fatal crash. Here is a quick and dirty monitoring script for Varnish. It essentially runs as a crontab job and requests a PING response. Should it not receive [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F05%2Fdirty-varnish-monitoring-script%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F05%2Fdirty-varnish-monitoring-script%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Depending on which version of Varnish you have running, there is a chance the code is still experimental and the whole Varnish daemon is prone to a fatal crash.</p>
<p>Here is a quick and dirty monitoring script for Varnish. It essentially runs as a crontab job and requests a PING response. Should it not receive a PONG from Varnish, it will attempt a restart. There is a second round of testing within the same script. This is a second level of PING request; just in case. Be sure to set the usual defaults like -T port and varnish runlevel script.</p>
<blockquote><p><code>#!/bin/bash</code></p>
<p><code>result=$(echo -e "ping\n\r" | nc localhost 6082|grep PONG|wc -l);</code></p>
<p><code>if [ "${result}" -lt "1" ];<br />
then<br />
/etc/init.d/varnish stop;<br />
sleep 5;<br />
/etc/init.d/varnish start;<br />
echo "$(hostname): Varnish restart" | mail -s "$(hostname): Restarting varnish" alerts@example.com;<br />
fi</code></p>
<p><code>sleep 5;</code></p>
<p><code>results=$(echo -e "ping\n\r" | nc localhost 6082|grep PONG|wc -l);</code></p>
<p><code>if [ "${results}" -lt "1" ];<br />
then<br />
/etc/init.d/varnish stop;<br />
sleep 5;<br />
/etc/init.d/varnish start;<br />
echo "$(hostname): Second Varnish restart" | mail -s "$(hostname): Restarting varnish second time" alerts@example.com;<br />
fi</code></p>
<p><code> </code></p>
<p><code>exit 0;</code></p></blockquote>
<p>Finally load the job into crontab:</p>
<blockquote><p><code>*/5 * * * * /root/varnish.sh</code></p></blockquote>
<p>A cleaner way of accomplishing the same goal would be to establish a permanent connection to the Varnish admin port (6082 in this case) and issue a PING command every other second or so. The interval can be in the sub seconds as opposed to minutes as is the case with crontab.</p>
<p>Here is an example:</p>
<blockquote><p><code># telnet localhost 6082<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
ping<br />
200 19<br />
PONG 1274931430 1.0<br />
ping<br />
200 19<br />
PONG 1274931434 1.0<br />
ping<br />
200 19<br />
PONG 1274931437 1.0<br />
ping<br />
200 19<br />
PONG 1274931443 1.0</code></p></blockquote>
<p>We deploy Varnish and other tools on our clients&#8217; server to get the most performance out of hardware. Our clients are happy with the performance boost and we are happy of the end result. Please do <a title="UNIXY's Portal" href="https://www.unixy.net/" target="_blank">get in touch</a> if you have any question or comment</p>
<p>That&#8217;s all folks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2010/05/dirty-varnish-monitoring-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>cPanel spamd resource consumption high</title>
		<link>http://blog.unixy.net/2010/04/cpanel-spamd-resource-consumption-high/</link>
		<comments>http://blog.unixy.net/2010/04/cpanel-spamd-resource-consumption-high/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 05:18:34 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Crash Course]]></category>
		<category><![CDATA[cPanel]]></category>
		<category><![CDATA[high]]></category>
		<category><![CDATA[memory usage]]></category>
		<category><![CDATA[spamd]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=299</guid>
		<description><![CDATA[Spamd is one the highest resource consumer on a cPanel server. It allocates a lot of memory from the get-go and holds on to it throughout. There is a way to limit the number of spamd processes that are spawned. On a cPanel server, which is what this guide covers, there is a configuration file [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F04%2Fcpanel-spamd-resource-consumption-high%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2010%2F04%2Fcpanel-spamd-resource-consumption-high%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Spamd is one the highest resource consumer on a cPanel server. It allocates a lot of memory from the get-go and holds on to it throughout. There is a way to limit the number of spamd processes that are spawned. On a cPanel server, which is what this guide covers, there is a configuration file called /etc/cpspamd.conf with the following lines:</p>
<blockquote><p><code>maxspare=1<br />
maxchildren=3</code></p></blockquote>
<p>For a leaner server. we recommend dropping maxchildren to 1 and maxspare to 1. This will save a good hundred of megs of memory. Don&#8217;t forget to restart exim for these changes to take effect.</p>
<p>I hope this tip is useful. That&#8217;s all folks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2010/04/cpanel-spamd-resource-consumption-high/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
