<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to save 100m of RAM per mongrel</title>
	<atom:link href="http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/</link>
	<description>The guys behind LivingSocial</description>
	<lastBuildDate>Mon, 08 Mar 2010 10:34:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ara</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-186</link>
		<dc:creator>Ara</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-186</guid>
		<description>Wait. Why do we need to workaround this? Why is Rails creating 100mb of extraneous objects *on startup*? Surely there is a problem with the default behavior in that case.</description>
		<content:encoded><![CDATA[<p>Wait. Why do we need to workaround this? Why is Rails creating 100mb of extraneous objects *on startup*? Surely there is a problem with the default behavior in that case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neeraj</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-187</link>
		<dc:creator>Neeraj</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-187</guid>
		<description>This is really really interesting. I will give the patch a try.</description>
		<content:encoded><![CDATA[<p>This is really really interesting. I will give the patch a try.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lourens Naude</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-188</link>
		<dc:creator>Lourens Naude</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-188</guid>
		<description>Aaron,

Routes double total RSS use for large applications.We had similar downsizing in our environment.

http://github.com/methodmissing/routing_with_optional_formats/tree/master

There&#039;s yet another optimization pattern - only mapping routes for actions that exist iow. if a controller only responds to 1 REST action, only map that, not all 7.

http://gist.github.com/23253

The current Rails initializer sequence complicates clean optimizations and to get the Gist snippet to fire, one has to do stick it in config/initializers/ and

RouteFilter.prune! if Rails.env.production?

in environment.rb, after the config block.This however still doesn&#039;t save on memory as downsizing an Enumerable doesn&#039;t yield memory back to the OS, but yields noticeable differences in recognition overhead.

The Anonymous module that installs named routes in ActionController, ActionView etc. is also a candidate for similar optimization ( undef_method ?, but see below ).

It would be most excellent if Rails::Initializer could be tweaked to setup routing AFTER preloading application klasses ( current default for Prod. env ) to allow for a more granular routing table, but this may break existing plugins, assumptions etc.

Getting this right has huge ramifications for the Rails hosting space.

Thoughts ?

- Lourens</description>
		<content:encoded><![CDATA[<p>Aaron,</p>
<p>Routes double total RSS use for large applications.We had similar downsizing in our environment.</p>
<p><a href="http://github.com/methodmissing/routing_with_optional_formats/tree/master" rel="nofollow">http://github.com/methodmissing/routing_with_optional_formats/tree/master</a></p>
<p>There&#8217;s yet another optimization pattern &#8211; only mapping routes for actions that exist iow. if a controller only responds to 1 REST action, only map that, not all 7.</p>
<p><a href="http://gist.github.com/23253" rel="nofollow">http://gist.github.com/23253</a></p>
<p>The current Rails initializer sequence complicates clean optimizations and to get the Gist snippet to fire, one has to do stick it in config/initializers/ and</p>
<p>RouteFilter.prune! if Rails.env.production?</p>
<p>in environment.rb, after the config block.This however still doesn&#8217;t save on memory as downsizing an Enumerable doesn&#8217;t yield memory back to the OS, but yields noticeable differences in recognition overhead.</p>
<p>The Anonymous module that installs named routes in ActionController, ActionView etc. is also a candidate for similar optimization ( undef_method ?, but see below ).</p>
<p>It would be most excellent if Rails::Initializer could be tweaked to setup routing AFTER preloading application klasses ( current default for Prod. env ) to allow for a more granular routing table, but this may break existing plugins, assumptions etc.</p>
<p>Getting this right has huge ramifications for the Rails hosting space.</p>
<p>Thoughts ?</p>
<p>- Lourens</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AkitaOnRails</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-189</link>
		<dc:creator>AkitaOnRails</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-189</guid>
		<description>@Lourens, feels like a nice good addition for Rails Core. Have you tried opening up a new Ticket with your implementation so Routes become more flexible and save more memory?</description>
		<content:encoded><![CDATA[<p>@Lourens, feels like a nice good addition for Rails Core. Have you tried opening up a new Ticket with your implementation so Routes become more flexible and save more memory?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hongli Lai</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-190</link>
		<dc:creator>Hongli Lai</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-190</guid>
		<description>Interesting. Have you also experimented with Phusion Passenger + Ruby Enterprise Edition? If you use those two together, then the memory occupied by the compiled routes will be shared between all Rails processes, which should also reduce your total memory usage significantly.</description>
		<content:encoded><![CDATA[<p>Interesting. Have you also experimented with Phusion Passenger + Ruby Enterprise Edition? If you use those two together, then the memory occupied by the compiled routes will be shared between all Rails processes, which should also reduce your total memory usage significantly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-191</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-191</guid>
		<description>I&#039;m very interested in trying this, but I can&#039;t seem to get it to work properly.  What version of Rails are you using?  Where are you placing the monkey-patch?

Thanks
-jeff</description>
		<content:encoded><![CDATA[<p>I&#8217;m very interested in trying this, but I can&#8217;t seem to get it to work properly.  What version of Rails are you using?  Where are you placing the monkey-patch?</p>
<p>Thanks<br />
-jeff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pratik</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-192</link>
		<dc:creator>Pratik</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-192</guid>
		<description>Rails lighthouse already has a patch for this at http://rails.lighthouseapp.com/projects/8994/tickets/1215-add-actions-and-formatted-options-to-mapresources

I imagine that should solve this problem.</description>
		<content:encoded><![CDATA[<p>Rails lighthouse already has a patch for this at <a href="http://rails.lighthouseapp.com/projects/8994/tickets/1215-add-actions-and-formatted-options-to-mapresources" rel="nofollow">http://rails.lighthouseapp.com/projects/8994/tickets/1215-add-actions-and-formatted-options-to-mapresources</a></p>
<p>I imagine that should solve this problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-193</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-193</guid>
		<description>Yes, please see my patch on Lighthouse, and add your voice there if you&#039;d like to see it included in Rails. Your comments and benchmarks would really help convince the core team.

Introspecting the controllers feels like a bit too much magic for me -- loading order problems aside, I&#039;m a fan of documenting the desired routes explicitly in routes.rb as you can see from the ticket -- but anything that reduces the astonishing memory overhead of the default routing is great news!</description>
		<content:encoded><![CDATA[<p>Yes, please see my patch on Lighthouse, and add your voice there if you&#8217;d like to see it included in Rails. Your comments and benchmarks would really help convince the core team.</p>
<p>Introspecting the controllers feels like a bit too much magic for me &#8212; loading order problems aside, I&#8217;m a fan of documenting the desired routes explicitly in routes.rb as you can see from the ticket &#8212; but anything that reduces the astonishing memory overhead of the default routing is great news!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anil</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-194</link>
		<dc:creator>Anil</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-194</guid>
		<description>It&#039;s really nice. I will give it a try.</description>
		<content:encoded><![CDATA[<p>It&#8217;s really nice. I will give it a try.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens</title>
		<link>http://blog.hungrymachine.com/2008/11/08/how-to-save-100m-of-ram-per-mongrel/comment-page-1/#comment-195</link>
		<dc:creator>Jens</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">blog.hungrymachine.com/2008/11/19/how-to-save-100m-of-ram-per-mongrel#comment-195</guid>
		<description>Sounds cool, but I don&#039;t really get it. Which version of rails did you monkey patch? All versions I checked (originally I wanted to apply this to one of our apps using rails 2.0.5) didn&#039;t had the methods you changed but had a lot of duplicated code in actionpack/lib/action_controller/resources.rb in the form:

        show_action_options = action_options_for(&quot;show&quot;, resource)
        map.named_route(&quot;#{resource.name_prefix}#{resource.singular}&quot;, resource.member_path, show_action_options)
        map.named_route(&quot;formatted_#{resource.name_prefix}#{resource.singular}&quot;, &quot;#{resource.member_path}.:format&quot;, show_action_options)

        update_action_options = action_options_for(&quot;update&quot;, resource)
        map.connect(resource.member_path, update_action_options)
        map.connect(&quot;#{resource.member_path}.:format&quot;, update_action_options)

        destroy_action_options = action_options_for(&quot;destroy&quot;, resource)
        map.connect(resource.member_path, destroy_action_options)
        map.connect(&quot;#{resource.member_path}.:format&quot;, destroy_action_options)

I tried to comment out the .format which worked ok, but that&#039;s of course much worse than monkey patching and only worth the experiment.</description>
		<content:encoded><![CDATA[<p>Sounds cool, but I don&#8217;t really get it. Which version of rails did you monkey patch? All versions I checked (originally I wanted to apply this to one of our apps using rails 2.0.5) didn&#8217;t had the methods you changed but had a lot of duplicated code in actionpack/lib/action_controller/resources.rb in the form:</p>
<p>        show_action_options = action_options_for(&quot;show&quot;, resource)<br />
        map.named_route(&quot;#{resource.name_prefix}#{resource.singular}&quot;, resource.member_path, show_action_options)<br />
        map.named_route(&quot;formatted_#{resource.name_prefix}#{resource.singular}&quot;, &quot;#{resource.member_path}.:format&quot;, show_action_options)</p>
<p>        update_action_options = action_options_for(&quot;update&quot;, resource)<br />
        map.connect(resource.member_path, update_action_options)<br />
        map.connect(&quot;#{resource.member_path}.:format&quot;, update_action_options)</p>
<p>        destroy_action_options = action_options_for(&quot;destroy&quot;, resource)<br />
        map.connect(resource.member_path, destroy_action_options)<br />
        map.connect(&quot;#{resource.member_path}.:format&quot;, destroy_action_options)</p>
<p>I tried to comment out the .format which worked ok, but that&#8217;s of course much worse than monkey patching and only worth the experiment.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
