<?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>Mission Data Blog &#187; apache</title>
	<atom:link href="http://www.missiondata.com/blog/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.missiondata.com/blog</link>
	<description>Louisville-based Web Development &#038; Software Engineering</description>
	<lastBuildDate>Tue, 18 May 2010 14:24:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mongrel vs. WEBrick</title>
		<link>http://www.missiondata.com/blog/system-administration/71/mongrel-vs-webrick/</link>
		<comments>http://www.missiondata.com/blog/system-administration/71/mongrel-vs-webrick/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 16:08:13 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/ruby/71/mongrel-vs-webrick/</guid>
		<description><![CDATA[We had the need to hook up a simple ruby web process (non-rails) to our production apache server.  As Leslie Hensley pointed out, fcgi and scgi are on the way out, and mongrel + mod_proxy_balancer is the new way to go.  We use mongrel extensively in our rails deploys, but always just used [...]]]></description>
			<content:encoded><![CDATA[<p>We had the need to hook up a simple ruby web process (non-rails) to our production apache server.  As <a href="http://www.papermountain.org/">Leslie Hensley</a> pointed out, fcgi and scgi are on the way out, and <a href="http://mongrel.rubyforge.org/">mongrel</a> + <a href="http://mongrel.rubyforge.org/docs/apache.html">mod_proxy_balancer</a> is the new way to go.  We use mongrel extensively in our rails deploys, but always just used <a href="http://www.webrick.org/">WEBrick</a> to do simple serving.  To make a long story short, we had to ask ourselves&#8230;.is mongrel that much better (and in this case better == faster) than WEBrick?</p>
<p><span id="more-71"></span></p>
<p>At first I decided my test would just respond with the yamlized request (just like the <a href="http://mongrel.rubyforge.org/rdoc/index.html">mongrel sample</a> did).  This worked fine but there was a significant size difference in the two documents (WEBrick&#8217;s was much bigger).  In the end, I just decided to respond with a few bytes of text. </p>
<h3>The Code</h3>
<p><b>mongrel_service.rb:</b> </p>
<pre>
<code>require 'rubygems'
require 'mongrel'
require 'yaml'

class SimpleHandler &lt; Mongrel::HttpHandler
  def process(request, response)
    response.start do |head,out|
      head["Content-Type"] = "text/html"
      out &lt;&lt; "I am mongrel, hear me roar"
    end
  end
end

config = Mongrel::Configurator.new :host =&gt; "localhost", :port =&gt; 4000 do
  listener {uri "/", :handler =&gt; SimpleHandler.new}
  trap("INT") { stop }
  run
end

config.join</code>
</pre>
<p>
<b>webrick_service.rb:</b></p>
<pre>
<code>require 'webrick'
require 'yaml'
include WEBrick

class SimpleServlet &lt; HTTPServlet::AbstractServlet
  def do_GET(request, response)
    response["Content-Type"] = "text/html"
    response.body = "I am WEBrick, hear me roar"
  end
end

s = HTTPServer.new( :Port =&gt; 4001 )
s.mount("/", SimpleServlet)
trap('INT'){ s.shutdown }
s.start</code>
</pre>
<h3>The Test</h3>
<p>There are <a href="http://www.joedog.org/JoeDog/Siege">serveral</a> <a href="http://www.hpl.hp.com/research/linux/httperf/">good</a> benchmarking tools available, but I had <a href="http://en.wikipedia.org/wiki/ApacheBench">apache bench (ab)</a> handy, so that is what I used.  I just used the stock gem install of mongrel and the WEBrick that comes with ruby 1.8.4 (the one non-stock change I made was to comment out access logging for WEBrick since mongrel doesn&#8217;t log by default).</p>
<h3>The Results</h3>
<table border="1">
<tr>
<th>Total Requests</th>
<th>Concurrent Connections</th>
<th>WEBrick (seconds) </th>
<th>Mongrel (seconds) </th>
</tr>
<tr>
<td>1000</td>
<td>1</td>
<td>1.889523</td>
<td>0.365838</td>
</tr>
<tr>
<td>10000</td>
<td>10</td>
<td>19.443034</td>
<td>4.411788</td>
</tr>
<tr>
<td>10000</td>
<td>100</td>
<td>20.906522</td>
<td>4.174591</td>
</tr>
</table>
<h3>The Conclusion</h3>
<p>Looks like mongrel it is&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/71/mongrel-vs-webrick/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Scary apache errors moving from prefork to worker</title>
		<link>http://www.missiondata.com/blog/system-administration/66/scary-apache-errors-moving-from-prefork-to-worker/</link>
		<comments>http://www.missiondata.com/blog/system-administration/66/scary-apache-errors-moving-from-prefork-to-worker/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 20:52:52 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/uncategorized/66/scary-apache-errors-moving-from-prefork-to-worker/</guid>
		<description><![CDATA[We were helping a client push more data through their apache/tomcat web application running on a Solaris box and decided to switch from the process (prefork) to the threaded(worker) processing model.  When we fired up the new apache we started getting errors like these:

[emerg] (45)Deadlock situation detected/avoided: apr_proc_mutex_lock failed. Attempting to shutdown process gracefully.

Not [...]]]></description>
			<content:encoded><![CDATA[<p>We were helping a client push more data through their apache/tomcat web application running on a Solaris box and decided to switch from the process (prefork) to the threaded(worker) processing model.  When we fired up the new apache we started getting errors like these:</p>
<pre>
<code>[emerg] (45)Deadlock situation detected/avoided: apr_proc_mutex_lock failed. Attempting to shutdown process gracefully.</code>
</pre>
<p>Not good.  After a <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=32325">little digging</a> we found that the default AcceptMutex switched from pthread to fcntl between apache 2.0.49 and 2.0.52.</p>
<p>Adding:</p>
<pre>
<code>AcceptMutex pthread</code>
</pre>
<p>to httpd.conf cleared up the errors and we&#8217;ve had smooth sailing ever since.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/66/scary-apache-errors-moving-from-prefork-to-worker/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
