<?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>Vallery.net &#187; lamp</title>
	<atom:link href="http://vallery.net/tag/lamp/feed/" rel="self" type="application/rss+xml" />
	<link>http://vallery.net</link>
	<description>personal homepage of Jason Vallery</description>
	<lastBuildDate>Thu, 08 Apr 2010 22:45:26 +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>Debug your outbound POST and GET requests</title>
		<link>http://vallery.net/2007/05/17/debug-your-outbound-post-and-get-requests/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=debug-your-outbound-post-and-get-requests</link>
		<comments>http://vallery.net/2007/05/17/debug-your-outbound-post-and-get-requests/#comments</comments>
		<pubDate>Thu, 17 May 2007 19:27:13 +0000</pubDate>
		<dc:creator>jvallery</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://vallery.net/2007/05/17/debug-your-outbound-post-and-get-requests/</guid>
		<description><![CDATA[I work a lot with different types of web services. I find when I&#8217;m building an application that has to post data off to a remote service that it can be difficult to debug where the problems are. I can&#8217;t always see an exact copy of the HTTP request that I am sending, and therefore [...]]]></description>
			<content:encoded><![CDATA[<p>I work a lot with different types of web services.  I find when I&#8217;m building an application that has to post data off to a remote service that it can be difficult to debug where the problems are.  I can&#8217;t always see an exact copy of the HTTP request that I am sending, and therefore how the remote service sees my call.  I created a simple little app that when called will return exactly what it was sent.  You can pass in variables in a POST or GET, and it will just spit them right back at you along with whatever HTTP headers were sent by your client.</p>
<p><!---more--></p>
<p>If you point your browser over to <a href="http://vallery.net/postback/index.php">http://vallery.net/postback/index.php</a> you can see it in action.  It will report back to you exactly how your browser is identifying itself, including any cookies you might have received from my word press blog!</p>
<p>Now the next time you are writing an application and you want to debug your outbound posts, just send them over to the above URL and it will respond with exactly what it received.</p>
<p>Pretty cool!</p>
]]></content:encoded>
			<wfw:commentRss>http://vallery.net/2007/05/17/debug-your-outbound-post-and-get-requests/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Optimizing WordPress and LAMP to survive the Digg effect</title>
		<link>http://vallery.net/2007/03/26/optimizing-wordpress-and-lamp-to-survive-the-digg-effect/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=optimizing-wordpress-and-lamp-to-survive-the-digg-effect</link>
		<comments>http://vallery.net/2007/03/26/optimizing-wordpress-and-lamp-to-survive-the-digg-effect/#comments</comments>
		<pubDate>Mon, 26 Mar 2007 13:40:34 +0000</pubDate>
		<dc:creator>jvallery</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[digg]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://vallery.net/2007/03/26/optimizing-wordpress-and-lamp-to-survive-the-digg-effect/</guid>
		<description><![CDATA[Anyone who has used digg for any amount of time has certainly come across a dead link. Invariably you click on the comment link hoping someone has posted a mirror of the content. You head over to duggmirror or coral cache to view the content. During the peak time right after an article hits the [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone who has used digg for any amount of time has certainly come across a dead link.  Invariably you click on the comment link hoping someone has posted a mirror of the content.  You head over to duggmirror or coral cache to view the content.  During the peak time right after an article hits the digg homepage, a given site might receive as many as 100 page loads per minute.  If this page is hosted on WordPress, or other MySQL based blog platform, combined with shared hosting, it&#8217;s a recipe for a crash.  Your site will go down in flames and you won&#8217;t have a chance of recovering until the load goes back to a lower level.</p>
<p>Recently I had an article hit the front page of Digg.  I was lucky because I had already done a number of things to optimize my server so that I survived.  My page never went down, and was very responsive for the entire duration of getting dugg.  My site is hosted on WordPress on a server that I own and manage.  The server hosts about 15 different domains, none of which are exceptionally high traffic sites.  The server isn&#8217;t anything special either.  It&#8217;s a single processor P4 3.0GHz with 512MB of memory running CentOS 4.4, Apache 2.0, PHP5, MySQL4.  I do have webalizer running on my Apache logs and I have the output of those posted at <a href="http://vallery.net/stats/">http://vallery.net/stats/</a> if you would like to see what the Digg effect can do.</p>
<p>I never exceeded more than a 0.15 <a href="http://en.wikipedia.org/wiki/Load_(computing)">load average</a> during the Digg.  Load average is a computation of how maxed out a Unix based system is.  You multiply the number of processors by 1, and this indicates the maximum load average that you can reasonably sustain.  If the load average exceeds this number, than your system is over utilized.  In my case, my max server load is 1 given that this is a single processor system.  This means I was only using 15% of my system resources during the maximum load that was generated from the Digg.</p>
<p>In order to optimize my system I have done the following things:</p>
<p>1) I&#8217;ve installed the WordPress 2.0 plugin <a href="http://mnm.uib.es/gallir/wp-cache-2/">wp-cache</a>.  This is something that every WordPress blog should have installed.  Especially on a shared hosting environment, it will dramatically increase your ability to handle high traffic.   The plugin generates the HTML for a given page and then saves it in a cache file.  When someone accesses your page, instead of fetching the content from the database it uses the already generated HTML in the cache to send to the browser.  This eliminates a number of fetches to the DB and dramatically speeds up page load times.</p>
<p>2)  Optimize Apache/MySQL to handle the expected number of database queries.  The most common error you receive when viewing a WordPress page that has been owned by the Digg effect is a database connection failed, or timeout.  When connecting to a MySQL database you can either have a persistent connection, or generate a new connection for each request.   There are a number of schools of thought as to which method is better, but generally speaking using persistent connections utilize more memory, so for me using a new connection for each request makes more sense.  A lot of the PHP blog templates including WordPress use these non-persistent connections as well.  The rub comes in the maximum number of said connections.  MySQL can be configured in your my.cnf file to say the maximum number of connections that can be created to the database.  If each instance of Apache (which in turn represents concurrent vistors to your page) has it&#8217;s own connection, then you can quickly exceed this maximum number of connections.  Apache similarly has a configuration option that dictates the maximum number of threads that can be concurrently running.  This number is specified in the httpd.conf file.  If the Apache number is larger than the MySQL number (which is the case in most default configurations) when you have more Apache threads running than MySQL is capable of handling, you get our nice &#8220;maximum number of connections&#8221; error message.</p>
<p>In /etc/my.cnf you want to set the variable &#8220;max_connections&#8221;.  I recommend something reasonably high like 250.<br />
In your httpd.conf file for Apache you want to set the variable &#8220;MaxClients&#8221;.  This should typically be the same number that you selected for MySQL.</p>
<p>3) Set reasonable Apache timeouts.  This means that no individual thread/connection can monopolize the system bringing all the other queries to its knees.  This protects you from rogue &#8220;edge&#8221; cases.</p>
<p>In your httpd.conf file set &#8220;Timeout&#8221; to a low number like 30 (measured in seconds) and &#8220;KeepAliveTimeout&#8221; to something like 3.</p>
<p>4) If your site makes it on to Digg, use real-time monitoring tools to measure your server&#8217;s health.  There are a number of command line tools available to help in this regard.  The first I would recommend is the tried and true &#8220;top&#8221; command.  This will display the processes running on your machine along with their associated memory and CPU usage.  Keep an eye and make sure things aren&#8217;t getting out of hand.  The second tool that I use is called &#8220;<a href="http://www.rhythm.cx/~steve/devel/tcptrack/">Tcptrack</a>&#8220;.  Tcptrack will need to be installed on your machine, but once it is it will give you a real time view of your incoming connections and bandwidth usage.</p>
<p>Happy Digging!</p>
]]></content:encoded>
			<wfw:commentRss>http://vallery.net/2007/03/26/optimizing-wordpress-and-lamp-to-survive-the-digg-effect/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>
