<?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>IT Know-It-All &#187; vz</title>
	<atom:link href="http://itkia.com/tag/vz/feed/" rel="self" type="application/rss+xml" />
	<link>http://itkia.com</link>
	<description>Applications, OS, Networking, Data</description>
	<lastBuildDate>Sat, 31 Jul 2010 12:53:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>2008 Update on Running Drupal on a Small VPS</title>
		<link>http://itkia.com/2008-update-on-running-drupal-on-a-small-vps/</link>
		<comments>http://itkia.com/2008-update-on-running-drupal-on-a-small-vps/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 22:26:05 +0000</pubDate>
		<dc:creator>IT Know-It-All</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[eaccelerator]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[vz]]></category>

		<guid isPermaLink="false">http://itkia.com/?p=53</guid>
		<description><![CDATA[Using Squid as a web accelerator to improve Apache mod_php efficiency with limited resources.]]></description>
			<content:encoded><![CDATA[<div>
<p>For a year or two I was successfully running Drupal with lighttpd and fastcgi. Lighttpd is very efficient, and having 4 fastcgi PHP processes let me limit the memory php used while keeping my small sites responsive enough. But redirects and URL rewriting are done differently, and it was tricky at times to get it to work the way I wanted with Drupal. I eventually got tired of wrestling with rewrites and redirects with every new non-Drupal php-based app I wanted to try, so I started thinking about how to make Apache work for a small site.</p>
<p>Now I am running Apache2/mod_php with a <a href="http://www.squid-cache.org/">Squid</a> front-end cache. If you&#8217;re not familiar with Squid, in brief it is a web proxy that caches web requests. It is often used to speed up clients but can be reversed to cache requests on the server end in web accelerator mode. Apache uses more RAM than lighttpd/fastcgi, and Squid uses RAM for itself and the cache, so I had to cut back two 2 Apache processes.</p>
<p>That may sound like too little, but here&#8217;s how it works well: the threads aren&#8217;t stuck delivering a request to a slow remote client because the local Squid cache accepts the request locally and then delivers it to the client freeing up the Apache process to handle the next request. 2 processes can handle my traffic because they can quickly deliver their payload to the cache and move on, and Squid can handle the delivery over the network to the client.</p>
<p>Of course sometimes the processes get hung up on slow MySQL queries or slow PHP queries, so occasionally I had delays. In particular I got rid of my RSS requests, because the Apache process had to wait while requesting RSS feeds from other sites, and sometimes that got slow or even timed out leaving just one Apache process handling requests, and if it stumbled on something then I&#8217;d have client requests waiting in line not getting served. So I got rid of my news feeds. Note that I am talking about my web site pulling feeds from other sites; of course I can offer RSS feeds for my Drupal blog with no such PHP delays. I also strive to keep my MySQL running smoothly, but everyone should do that, anyway.</p>
<p>The downside of using Squid is logging. Since Squid is my front-end web server I have Apache listen on 127.0.0.1:80, and Squid accesses it there. So my Apache log files show all requests coming from 127.0.0.1, and many static page or image requests don&#8217;t come through because Squid has them cached. However I configured Squid to log in Apache log format and just use those logs instead.</p>
<p>Of course dynamic content from Drupal has the nocache header, so Squid isn&#8217;t caching the dynamic content for future requests, but it still frees up Apache while delivering it to the client. It does cache the static files like images, style sheets and javascript files, so the Apache threads mostly focus on dynamic content only.</p>
<p>Another way I keep memory usage down is with <a href="http://eaccelerator.net/">eaccelerator</a>. It caches PHP scripts so they don&#8217;t have to recompile every time they&#8217;re run. This can save memory in addition to processor time. After changing Drupal or any of my scripts I usually delete the cache and click around my sites to force all the php to run so eaccelerator will cache it. Then I restart my php processes (Apache2 in the case of Apache/mod-php or the fastcgi server if using fastcgi) to lower their memory usage. After that the cached scripts should run and the PHP processes shouldn&#8217;t bloat as much. Note that every time PHP is updated eaccelerator must be recompiled. In older PHP versions it would crash if you didn&#8217;t, but now it just silently (except for a log entry) fails to cache your scripts if you forget to recompile after a PHP update.</p>
<p>With lighttpd/fastcgi I was able to run 4 PHP processes (memory_limit from 8MB &#8211; 16MB), lighttpd, MySQL and Exim (my mail daemon) in a 256mb VPS with good speed. With Apache2/mod_php I am running 2 Apache2/mod_php processes, Squid (8 MB cache memory), MySQL and Exim in a 256mb VPS. Having only two processes forces me to watch for slow requests like a hawk, but Squid takes care of slow clients. I still ran into memory problems occasionally, but now I have a 384mb VPS and haven&#8217;t had a privvm failure yet.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://itkia.com/2008-update-on-running-drupal-on-a-small-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VPS and Sneaky CPU Problems</title>
		<link>http://itkia.com/vps-and-sneaky-cpu-problems/</link>
		<comments>http://itkia.com/vps-and-sneaky-cpu-problems/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 03:09:45 +0000</pubDate>
		<dc:creator>IT Know-It-All</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[vz]]></category>

		<guid isPermaLink="false">http://itkia.com/?p=51</guid>
		<description><![CDATA[My scheduled backup processes made web apps unresponsive.]]></description>
			<content:encoded><![CDATA[<div>
<p>While trying to find the perfect balance to make my sites run well out of my small VPS I noticed that my CPU usage was spiking. Unlike memory issues the Virtuozzo Power Panel didn&#8217;t issue a QoS alert for CPU overages. Apparently when you use too much CPU you just don&#8217;t get cycles for a while. Due to the spiky nature of CPU usage you don&#8217;t see the problem unless you catch it near the top of a spike.</p>
<p>I realized that my backup processes were helping to spike the CPU. I have a cron job to a mysql dump, and I have a remote machine regularly ssh/rsync in to copy files off. ssh and rsync use quite a bit of CPU. I should&#8217;ve realized that would happen, but &#8220;duhhhh&#8221;. I changed all my nonessential scripts to &#8220;nice&#8221; the commands. rsync was a bit tricky to get &#8220;nice&#8221;d, but I found the answers via Googling. What&#8217;s interesting is that Virtuozzo doesn&#8217;t seem to count the nice&#8217;d processes against the VPS&#8217;s CPU usage. They used spare host cycles apparently, and there are tons of spare host cycles. I think I actually sped my backups up with &#8220;nice&#8221;.</p>
<p>It&#8217;s tempting to try to run services nice&#8217;d, because I seem to get more &#8220;spare&#8221; cpu cycles than I get normal ones, but I have a feeling that will cause one problem or another down the line.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://itkia.com/vps-and-sneaky-cpu-problems/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
