<?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>Hungry Machine &#187; haproxy</title>
	<atom:link href="http://blog.hungrymachine.com/tag/haproxy/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hungrymachine.com</link>
	<description>The guys behind LivingSocial</description>
	<lastBuildDate>Sun, 25 Oct 2009 15:08:39 +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>Reviewing Application Health with HAProxy Stats</title>
		<link>http://blog.hungrymachine.com/2008/03/27/analyzing-application-performance-with-haproxy-stats/</link>
		<comments>http://blog.hungrymachine.com/2008/03/27/analyzing-application-performance-with-haproxy-stats/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 11:29:00 +0000</pubDate>
		<dc:creator>val</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Ops]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[haproxy]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">blog.hungrymachine.com/2008/06/05/analyzing-application-performance-with-haproxy-stats</guid>
		<description><![CDATA[
One of the methods we use for checking the health of our applications is stats collected from HAProxy. We utilize it to see how many requests are scheduled for execution on mongrel instances. The graph is one indication of how our applications perform. When we launched the new version of the site three weeks ago, [...]]]></description>
			<content:encoded><![CDATA[<div>
One of the methods we use for checking the health of <a href="http://www.livingsocial.com/">our applications</a> is stats collected from <a href="http://haproxy.1wt.eu/">HAProxy</a>. We utilize it to see how many requests are scheduled for execution on mongrel instances. The graph is one indication of how our applications perform. When we launched the new version of the site three weeks ago, the graph for a single vertical (ReadingSocial) on a typical Tuesday looked like this:
</div>
<div style="padding-top: 10px;">
<img src="http://blog.hungrymachine.com/assets/2008/3/27/old-hastats.jpg" width="100%" />
</div>
<div style="padding-top: 20px;">
So, between porting all verticals to Myspace, Orkut, Bebo, and enhancing the functionality, we spent some time on optimization. In addition to analyzing slow-query logs with <a href="http://hackmysql.com/mysqlsla">mysqlsla</a>, Aaron wrapped all external API calls (and we do a lot of them &#8211; to Amazon, Facebook, Myspace, etc) in slow monitoring so we could see where the latest external bottleneck was so we could fix it one by one. Three weeks later the graph became much more peaceful:
</div>
<div style="padding: 10px 0;">
<img src="http://blog.hungrymachine.com/assets/2008/3/27/new-hastats.jpg" width="100%" />
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.hungrymachine.com/2008/03/27/analyzing-application-performance-with-haproxy-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring Rails Apps:  Pulse + More</title>
		<link>http://blog.hungrymachine.com/2007/10/26/monitoring-rails-apps-pulse-more/</link>
		<comments>http://blog.hungrymachine.com/2007/10/26/monitoring-rails-apps-pulse-more/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 20:40:00 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[haproxy]]></category>
		<category><![CDATA[Ops]]></category>

		<guid isPermaLink="false">blog.hungrymachine.com/2007/10/26/monitoring-rails-apps-pulse-more</guid>
		<description><![CDATA[Paul Gross from Thoughtworks recently created a pulse gem. The gem adds a simple action to your rails app, &#8220;/pulse&#8221;, which acts as a heartbeat.
The pulse gem currently defines the method as:


def pulse
   render :text =&#62; &#34;OK&#34;
end


Then you can configure haproxy to monitor your application by hitting  http://server/pulse and verifying the response [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pgrs.net/">Paul Gross</a> from <a href="http://www.thoughtworks.com/">Thoughtworks</a> recently created a <a href="http://www.pgrs.net/2007/10/26/announcing-new-gem-pulse">pulse</a> gem. The gem adds a simple action to your rails app, &#8220;/pulse&#8221;, which acts as a heartbeat.<br/><br/></p>
<p>The pulse gem currently defines the method as:</p>
<div class="CodeRay">
<div class="code">
<pre><span style="color:#080; font-weight:bold">def</span> <span style="color:#06B; font-weight:bold">pulse</span>
   render <span style="color:#A60">:text</span> =&gt; <span style="background-color:#fff0f0"><span style="color:#710">&quot;</span><span style="color:#D20">OK</span><span style="color:#710">&quot;</span></span>
<span style="color:#080; font-weight:bold">end</span></pre>
</div>
</div>
<p>Then you can configure haproxy to monitor your application by hitting  http://server/pulse and verifying the response is &#8220;OK&#8221;. <br/><br/></p>
<p>We&#8217;ve had a similar action in our applications for quite some time, although I really like the idea of externalizing it to a gem.  Our implementation is slightly different though.  Since so many rails applications depend on a database, I instead added:</p>
<div class="CodeRay">
<div class="code">
<pre><span style="color:#080; font-weight:bold">def</span> <span style="color:#06B; font-weight:bold">pulse</span>
    rows = <span style="color:#036; font-weight:bold">ActiveRecord</span>::<span style="color:#036; font-weight:bold">Base</span>.connection.execute(<span style="background-color:#fff0f0"><span style="color:#710">&quot;</span><span style="color:#D20">select 1 from dual</span><span style="color:#710">&quot;</span></span>).num_rows <span style="color:#080; font-weight:bold">rescue</span> <span style="color:#00D; font-weight:bold">0</span>
    render <span style="color:#A60">:text</span> =&gt; rows == <span style="color:#00D; font-weight:bold">1</span> ? <span style="background-color:#fff0f0"><span style="color:#710">&quot;</span><span style="color:#D20">OK</span><span style="color:#710">&quot;</span></span> : <span style="background-color:#fff0f0"><span style="color:#710">&quot;</span><span style="color:#D20">Error!</span><span style="color:#710">&quot;</span></span>
<span style="color:#080; font-weight:bold">end</span></pre>
</div>
</div>
<p>IIRC, &#8220;select 1 from dual&#8221; is the fastest query you can run against a database, in MySQL, Oracle, and Postgres.  And if you have mutliple databases, you can add union in the one pulse request, or have multiple actions. <br/><br/></p>
<p>Now you are not only testing your application is live, but that it can connect to the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hungrymachine.com/2007/10/26/monitoring-rails-apps-pulse-more/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
