<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Rubynaut</title>
    <link>http://www.rubynaut.net</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description />
    <image><link>http://www.rubynaut.net</link><url>http://www.rubynaut.net/images/rubynaut.png</url><title>Rubynaut</title></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Rubynaut" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <title>DON'T USE &amp;quot;DISABLE WITH TEXT&amp;quot; OPTION WITH YOUR JQUERY AJAX BINDING</title>
      <description>&lt;p&gt;I ve just spent 5 hours to understand what was going wrong with my ajaxy form. I use jquery on rails and ajaxForm plugin, I have some form already working good and tried to a new one.&lt;/p&gt;


	&lt;p&gt;But this time it doesnt work, I dont understand why my form send twice the request, first with ajax header and second time with html request. I even tried to write raw javascrit, livequery and so on. Nothing make it works. Finally I want to check a little thing I add on the form: &amp;#8216;disable with text&amp;#8217; option. I disabled it and miracle it works now.&lt;/p&gt;


	&lt;p&gt;I ve lost 5 hour of my time for this little cosmetic tool that s mess up ajax binding.&lt;/p&gt;


	&lt;p&gt;Then my advice: &lt;span class="caps"&gt;DON&lt;/span&gt;&amp;#8217;T &lt;span class="caps"&gt;USE&lt;/span&gt; &amp;#8220;DISABLE &lt;span class="caps"&gt;WITH TEXT&lt;/span&gt;&amp;#8221; &lt;span class="caps"&gt;OPTION WITH YOUR JQUERY AJAX BINDING&lt;/span&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=xFapOewNuI4:0ezzf5C0acg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=xFapOewNuI4:0ezzf5C0acg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=xFapOewNuI4:0ezzf5C0acg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=xFapOewNuI4:0ezzf5C0acg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Mon, 10 Aug 2009 09:22:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:4c368eba-06e3-4e7b-80d5-6a4b32cff8fd</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/xFapOewNuI4/dont-use-disable-with-text-option-with-your-jquery-ajax-binding</link>
      <category>ruby on rails</category>
      <category>ajax</category>
      <category>jquery</category>
    <feedburner:origLink>http://www.rubynaut.net/articles/2009/08/10/dont-use-disable-with-text-option-with-your-jquery-ajax-binding</feedburner:origLink></item>
    <item>
      <title>How to access multiple databases with rails</title>
      <description>&lt;p&gt;I know it exists other information about this, but I want to summarize here the practise I use in several project now. It takes 4 steps:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;configure your database.yml&lt;/li&gt;
		&lt;li&gt;create an abstract class for connection&lt;/li&gt;
		&lt;li&gt;create new models within a module&lt;/li&gt;
		&lt;li&gt;interact the 2 databases&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h3&gt;1. Configure your database.yml&lt;/h3&gt;


	&lt;p&gt;This is the same as you create production or development connection, just give it a specific name:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;other_database_connection:
    adapter: postgresql
    encoding: utf8
    database: database_name
    username: user
    password: password
    host: localhost&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;2. Create an abstract class for connection&lt;/h3&gt;


	&lt;p&gt;Then create an abstract class you will inheritate by your new classes:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;class External &amp;lt; ActiveRecord::Base
  self.abstract_class = true
  establish_connection :other_database_connection
end&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;3. Create new models within a module&lt;/h3&gt;


	&lt;p&gt;To make it easier to use and cleaner, create a subfolder &lt;i&gt;OtherDatabase&lt;/i&gt; and then create in this folder your new classes (for each table you need) as following:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;class OtherDatabase::NewClass1 &amp;lt; External
end&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;4. How to interact the 2 databases&lt;/h3&gt;


	&lt;p&gt;Once you have created your new classes, you can simply access it using the module prefix:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;new_object = OtherDatabase::NewClass1.new
.
result = OtherDatabase::NewClass1.find(:all)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Conclusion&lt;/h3&gt;


	&lt;p&gt;That&amp;#8217;s all, submodule is not really necessary but keeps your model folder cleaner. Any suggestion to improve this practise ?&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=zdCSKDRFOdQ:ycJ_6SZQHQg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=zdCSKDRFOdQ:ycJ_6SZQHQg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=zdCSKDRFOdQ:ycJ_6SZQHQg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=zdCSKDRFOdQ:ycJ_6SZQHQg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Sat, 31 May 2008 19:08:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:cdab0bde-77f9-4bc3-a266-f307e51dff36</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/zdCSKDRFOdQ/how-to-access-multiple-database-in-rails</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/05/31/how-to-access-multiple-database-in-rails</feedburner:origLink></item>
    <item>
      <title>Rails: find controller for a path</title>
      <description>&lt;p&gt;Huh, seems simple to do :p, but I&amp;#8217;ve been seeking for a while to find the answer and dig into rails code to find a simple method to retrieve the controller of a given path (could be useful to build a navigation). There it is:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="constant"&gt;ActionController&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Routing&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Routes&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;recognize_path&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;path&lt;/span&gt;&lt;span class="punct"&gt;)[&lt;/span&gt;&lt;span class="symbol"&gt;:controller&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=JV6WuBK21go:81nsKrTy5DY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=JV6WuBK21go:81nsKrTy5DY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=JV6WuBK21go:81nsKrTy5DY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=JV6WuBK21go:81nsKrTy5DY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Sun, 06 Apr 2008 14:20:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:c3f1bc7a-6a43-4750-a03c-c9ec03c8f625</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/JV6WuBK21go/rails-find-controller-for-a-path</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/04/06/rails-find-controller-for-a-path</feedburner:origLink></item>
    <item>
      <title>Ebb, even faster than Thin</title>
      <description>&lt;p&gt;&lt;a href="http://ebb.rubyforge.org/"&gt;Ebb&lt;/a&gt; is new server to put in front of a rackable ruby application.&lt;/p&gt;


	&lt;p&gt;Have a look to the &lt;a href="http://ebb.rubyforge.org/"&gt;Ebb website&lt;/a&gt; to get some comparison with other app servers.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo gem install ebb&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;What I needed to do before on Mac &lt;span class="caps"&gt;OS X&lt;/span&gt; (leopard with MacPorts):&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo port install glib2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=qwdwIhQtRqs:noXqJQ7lpto:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=qwdwIhQtRqs:noXqJQ7lpto:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=qwdwIhQtRqs:noXqJQ7lpto:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=qwdwIhQtRqs:noXqJQ7lpto:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Tue, 04 Mar 2008 22:02:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:b5dfc0c2-fcb8-4713-b806-3fb803949808</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/qwdwIhQtRqs/ebb-even-faster-than-thin</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/03/04/ebb-even-faster-than-thin</feedburner:origLink></item>
    <item>
      <title>Git: Easy way to setup a private remote repository</title>
      <description>&lt;p&gt;Git is different from svn and create a private repository on a remote server too. No need of gitosis or git-daemon for this.&lt;/p&gt;


	&lt;p&gt;I start from an existing project and a server I already access to with ssh key.&lt;/p&gt;


	&lt;p&gt;First, initialize git in your project:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;git init
git add .
git commit -m 'initial import'&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;[update]&lt;/p&gt;


	&lt;p&gt;&lt;del&gt;Then create a git copy of your project into a git archive &lt;em&gt;my_project_folder.git&lt;/em&gt;.&lt;/del&gt;&lt;/p&gt;


	&lt;p&gt;&lt;del&gt;git clone&amp;#8212;bare my_project_folder my_project_folder.git&lt;/del&gt;&lt;/p&gt;


	&lt;p&gt;Copy &lt;del&gt;this archive&lt;/del&gt; the .git folder to your remote server:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;scp -rp .git user@server://path/to/repositories/my_project_folder.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Add this new repository in the config of your local project:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;git remote add my_remote_repo ssh://server/path/to/repositories/my_project_folder.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You&amp;#8217;re done. After a change you can commit and then push your change to the remote repo:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;git commit -m &amp;quot;message for change log&amp;quot;
git push my_remote_repo&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Use your own parameters for:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;em&gt;my_project_folder&lt;/em&gt; with the folder of your project&lt;/li&gt;
		&lt;li&gt;&lt;em&gt;path/to/repositories&lt;/em&gt; with the path to your repository on the remote server&lt;/li&gt;
		&lt;li&gt;&lt;em&gt;my_project_repo&lt;/em&gt; with the name you want for the remote repository, usually &lt;em&gt;origin&lt;/em&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;If you need a public repository, have look to gitosis or git-daemon. Best is Github.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=ZmOYjark3j4:EIGyHxA4WGU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=ZmOYjark3j4:EIGyHxA4WGU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=ZmOYjark3j4:EIGyHxA4WGU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=ZmOYjark3j4:EIGyHxA4WGU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Tue, 04 Mar 2008 20:41:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:8922639a-d762-404c-b73f-30b15c166893</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/ZmOYjark3j4/git-easy-way-to-setup-a-private-remote-repository</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/03/04/git-easy-way-to-setup-a-private-remote-repository</feedburner:origLink></item>
    <item>
      <title>Model inheritance with Merb</title>
      <description>&lt;p&gt;&lt;em&gt;from help on irc#merb&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;I had recurrent issue about inherit a model class from another one in Merb, using ActiveRecord or DataMapper. As it&amp;#8217;s &amp;#8216;magicly&amp;#8217; done on Rails I though the same way in Merb, but the last one load model class in alpha order. then what you have to do is to load the first class with a require:&lt;/p&gt;


	&lt;p&gt;in your first file:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;Page&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ActiveRecord&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Base&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;then in second add the require:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;page&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;ActivePage&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;Page&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Simply using ruby&amp;#8230;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=1mGEEtfaweU:fPS0b6NNabw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=1mGEEtfaweU:fPS0b6NNabw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=1mGEEtfaweU:fPS0b6NNabw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=1mGEEtfaweU:fPS0b6NNabw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Thu, 21 Feb 2008 22:16:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:0ef75e5e-f6fa-46b8-a465-b94b7f2436c4</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/1mGEEtfaweU/model-inheritance-with-merb</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/02/21/model-inheritance-with-merb</feedburner:origLink></item>
    <item>
      <title>Most used front end: poll results </title>
      <description>&lt;p&gt;For severals month now I put a poll about which front end people use for their website. Even if it s not a reference with only 85 votes I would like to publsih some result. Of course as the content of this website is ruby oriented, then the results will be also.&lt;/p&gt;


	&lt;p&gt;First it started with most of votes for apache. At the end Apache it&amp;#8217;s still the  first:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;47%: apache&lt;/li&gt;
		&lt;li&gt;40%: nginx &lt;/li&gt;
		&lt;li&gt;7% : lighttpd&lt;/li&gt;
		&lt;li&gt;5% : others&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The result for nginx is over general real stats but for the trend is here and nginx is more and more the choice for a ruby stack as I did present in my &lt;a href="http://www.rubynaut.net/articles/2008/02/19/railsconf-scaling-a-rails-app-part-3-of-3"&gt;last post&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=YOnyqnWPovk:mVlguKvYOFA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=YOnyqnWPovk:mVlguKvYOFA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=YOnyqnWPovk:mVlguKvYOFA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=YOnyqnWPovk:mVlguKvYOFA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Wed, 20 Feb 2008 13:35:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:f5b291f6-b482-4b2c-bcbb-3889f8bc86d9</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/YOnyqnWPovk/most-used-front-end-poll-results</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/02/20/most-used-front-end-poll-results</feedburner:origLink></item>
    <item>
      <title>Scaling a Rails app (Part 3 of 3)</title>
      <description>&lt;p&gt;This the third and last part for a summary about solutions to help better computing of your rails app&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.rubynaut.net/articles/2007/10/10/scaling-a-rails-app-part-1-of-3"&gt;1st part&lt;/a&gt;.&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.rubynaut.net/articles/2007/10/14/railsconf-scaling-a-rails-app-part-2-of-3"&gt;2nd part&lt;/a&gt;.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h4&gt;Some home made benchmarks&lt;/h4&gt;


	&lt;p&gt;&lt;em&gt;NB: Following benchmarks have been made to a quick look study and not for a proof of concept.&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;The test machine (dedibox, ubuntu 6.10) is 1 core cpu @2Ghz &amp;#8211; 1024 Mo memory. In each case the http server uses 10 processes on a real world application (not just &amp;#8216;hello world!&amp;#8217;). Sending 500 rq with 1 or 10 concurrency req:&lt;/p&gt;


	&lt;table style="border:1px solid black; ;"&gt;
		&lt;tr&gt;
			&lt;th&gt;conc. req. &lt;/th&gt;
			&lt;th&gt;1 &lt;/th&gt;
			&lt;th&gt;10 &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; apache &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; mongrel &lt;/td&gt;
			&lt;td&gt; 39.4s &amp;#8211; 12.7 r/s &lt;/td&gt;
			&lt;td&gt; 21.9s &amp;#8211; 22.8 r/s &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; thin &lt;/td&gt;
			&lt;td&gt; 37.6s &amp;#8211; 13.3 r/s &lt;/td&gt;
			&lt;td&gt; 17.7s &amp;#8211; 28,15 r/s &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;

		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; nginx &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; mongrel &lt;/td&gt;
			&lt;td&gt; 39.2s &amp;#8211; 12.8 r/s &lt;/td&gt;
			&lt;td&gt; 22.2s &amp;#8211; 22.5 r/s &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; thin 0.5.4 &lt;/td&gt;
			&lt;td&gt; 39.8s &amp;#8211; 12.6 r/s &lt;/td&gt;
			&lt;td&gt; 17.7s &amp;#8211; 28.15 r/s &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; thin 0.6.1 socket x2 &lt;/td&gt;
			&lt;td&gt; 37.6s &amp;#8211; 13.3 r/s &lt;/td&gt;
			&lt;td&gt;  17.8s &amp;#8211; 28.1 r/s &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;&lt;br/&gt;&lt;/p&gt;


	&lt;p&gt;Since last time, Rails world has a new nice app server: thin. Replacement of mongrel, based on rack interface, it&amp;#8217;s also recently added a unix socket connector where usually we use IP connector. For better performance, avoid longest stuff as scripts (google analytics). Other scripts/images/css are keys in http performances also, usage of &lt;a href="http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release"&gt;assets&lt;/a&gt; in recommended.&lt;/p&gt;


	&lt;p&gt;As we can see in equivalent configuration there is no major difference for http server. Thin seems to be definitly faster than mongrel when you need to server more than 1 request at a time. And of course on a 1 core cpu, having more than one app server doesnt make the content served really faster.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Memory usage&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Mongrel (48 Mo) -&amp;gt; Thin (40 Mo) less 15%&lt;/p&gt;


	&lt;p&gt;Apache (10 Mo) -&amp;gt; Nginx (1.4 Mo) less 85%&lt;/p&gt;


	&lt;p&gt;Finally I decided to move to a nginx / thin on socket configuration because of the memory usage and the fair performances. I even moved my &lt;span class="caps"&gt;PHP&lt;/span&gt; stuff with an fcgi connector.&lt;/p&gt;


	&lt;p&gt;Other ideas of tests: Varnish, Nginx and memcached. Maybe next time :)&lt;/p&gt;


	&lt;p&gt;[update]&lt;/p&gt;


	&lt;p&gt;Please find a good benchmark about nginx vs apache on &lt;a href="http://www.joeandmotorboat.com/2008/02/28/apache-vs-nginx-web-server-performance-deathmatch/"&gt;Joe&amp;#8217;s blog&lt;/a&gt;&lt;/p&gt;


	&lt;h4&gt;Overall conclusion&lt;/h4&gt;


	&lt;p&gt;I think when we need to compare two framework, about which one is faster, we should keep in mind all these levels of optimisation to scale an application, and then the raw performance is a secondary issue.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=DglfwdPTNWI:GJRfSmbVqXE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=DglfwdPTNWI:GJRfSmbVqXE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=DglfwdPTNWI:GJRfSmbVqXE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=DglfwdPTNWI:GJRfSmbVqXE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Tue, 19 Feb 2008 18:05:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:f887137e-4a4d-474d-be4f-d7ed93f7dd42</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/DglfwdPTNWI/railsconf-scaling-a-rails-app-part-3-of-3</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/02/19/railsconf-scaling-a-rails-app-part-3-of-3</feedburner:origLink></item>
    <item>
      <title>Radiant to Merb</title>
      <description>&lt;p&gt;Merb is a (future) great framework. Radiant is good &lt;span class="caps"&gt;CMS&lt;/span&gt;. And they have so much in common. I&amp;#8217;m curious about porting Radiant to Merb then I started the challenge. For people interested in the same challenge, I set up a &lt;a href="http://gitorious.org/projects/merb_radiant"&gt;repository&lt;/a&gt;. Then please feel free to participate.&lt;/p&gt;


	&lt;p&gt;[update]&lt;/p&gt;


	&lt;p&gt;I got invited on github then I cloned the git repository to &lt;a href="http://github.com/sbusso/merb_radiant/tree/master"&gt;http://github.com/sbusso/merb_radiant/tree/master&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;Action plan:&lt;/h3&gt;


	&lt;p&gt;Merb is a framework equivalent to Action Pack. It can use Active Record. For generator we can use Rubigen, it s an extract of RailsGenerator.&lt;/p&gt;


	&lt;p&gt;For this we will use:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Radiant trunk r742&lt;/li&gt;
		&lt;li&gt;Merb (core and more) 0.9.0&lt;/li&gt;
		&lt;li&gt;Merb helpers 0.9.0&lt;/li&gt;
		&lt;li&gt;Merb ActiveRecord 0.9.0&lt;/li&gt;
		&lt;li&gt;ActiveRecord 2.0.2&lt;/li&gt;
		&lt;li&gt;Rubigen 1.2.0&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The repository tree was build with:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Hoe (modified) generated skeleton&lt;/li&gt;
		&lt;li&gt;Merb application&lt;/li&gt;
		&lt;li&gt;Radiant source&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h4&gt;1. Move Radiant base:&lt;/h4&gt;


	&lt;ul&gt;
	&lt;li&gt;use plugins as gem:

	&lt;ul&gt;
	&lt;li&gt;radius 0.5.1&lt;/li&gt;
		&lt;li&gt;highline 1.4.0&lt;/li&gt;
		&lt;li&gt;rubypants 0.2.0&lt;/li&gt;
	&lt;/ul&gt;
&lt;/li&gt;
		&lt;li&gt;use other plugins as ruby libraries:	&lt;ul&gt;
	&lt;li&gt;redcloth&lt;/li&gt;
		&lt;li&gt;bluecloth&lt;/li&gt;
	&lt;/ul&gt;
&lt;/li&gt;
		&lt;li&gt;using active record: nothing to do&lt;/li&gt;
		&lt;li&gt;radius and other ruby libs: nothing to do&lt;/li&gt;
		&lt;li&gt;replace RailsGenerator with Rubigen (Radiant bin)&lt;/li&gt;
		&lt;li&gt;work on initializer&lt;/li&gt;
		&lt;li&gt;desactivate extension dependencies (first step we move only the base)&lt;/li&gt;
		&lt;li&gt;manage Controller and libraries using controllers&lt;/li&gt;
		&lt;li&gt;check routes management&lt;/li&gt;
		&lt;li&gt;work on views to replace Rails specific code&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h4&gt;2. Replace extension system with gems:&lt;/h4&gt;


	&lt;ul&gt;
	&lt;li&gt;first, activate gem with only code features&lt;/li&gt;
		&lt;li&gt;second, deal with extension providing assets&lt;/li&gt;
	&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=CLawu3Flevs:tGSbFStpy7M:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=CLawu3Flevs:tGSbFStpy7M:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=CLawu3Flevs:tGSbFStpy7M:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=CLawu3Flevs:tGSbFStpy7M:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Sun, 17 Feb 2008 20:33:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:82ff0fbc-c409-4370-884f-a0a785c349ed</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/CLawu3Flevs/radiant-to-merb</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/02/17/radiant-to-merb</feedburner:origLink></item>
    <item>
      <title>Merb 0.9.0 - only for developer</title>
      <description>&lt;p&gt;Following the next version of Merb, I&amp;#8217;m a bit surprised by the way this new version came out:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://gweezlebur.com/2008/2/14/merb-0-9-0-released-kinda"&gt;Merb 0.9.0&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Help of developers is needed for going on 1.0, then install it and try it.&lt;/p&gt;


	&lt;p&gt;Included :&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;merb-core&lt;/li&gt;
		&lt;li&gt;merb-action-args&lt;/li&gt;
		&lt;li&gt;merb-assets&lt;/li&gt;
		&lt;li&gt;merb-gen&lt;/li&gt;
		&lt;li&gt;merb-haml&lt;/li&gt;
		&lt;li&gt;merb-mailer&lt;/li&gt;
		&lt;li&gt;merb-parts&lt;/li&gt;
		&lt;li&gt;merb-more&lt;/li&gt;
		&lt;li&gt;merb&lt;/li&gt;
	&lt;/ul&gt;


then 
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;merb-gen myapp&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=M1AuRQdKcb8:zjc4NVZZ8rw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=M1AuRQdKcb8:zjc4NVZZ8rw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=M1AuRQdKcb8:zjc4NVZZ8rw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=M1AuRQdKcb8:zjc4NVZZ8rw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Thu, 14 Feb 2008 22:02:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:6f42ffd3-ecdc-4b3b-ac3f-c6d07cba1cd7</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/M1AuRQdKcb8/merb-0-9-0-only-for-developper</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/02/14/merb-0-9-0-only-for-developper</feedburner:origLink></item>
    <item>
      <title>Install ruby memcached on MacOSX</title>
      <description>&lt;p&gt;Classical way, download following archives and compile it in the order. Xcode has to be installed.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;tar xzf *.tar.gz
cd 
./configure
make 
sudo make install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;ol&gt;
	&lt;li&gt;lib need for server: &lt;a href="http://www.monkey.org/~provos/libevent/"&gt;lib event&lt;/a&gt;. &lt;a href="http://www.monkey.org/~provos/libevent-1.4.1-beta.tar.gz"&gt;download&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;the server: &lt;a href="http://www.danga.com/memcached/"&gt;memcached&lt;/a&gt;. &lt;a href="http://www.danga.com/memcached/dist/memcached-1.2.4.tar.gz"&gt;download&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;the client lib written in c: &lt;a href="http://tangent.org/552/libmemcached.html"&gt;libmemcached&lt;/a&gt;. &lt;a href="http://download.tangent.org/libmemcached-0.15.tar.gz"&gt;download&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;the ruby binding: &lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo gem install memcached&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt; or with leopard: &lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo env ARCHFLAGS=&amp;quot;-arch i386&amp;quot; gem install memcached&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;/ol&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=h3Xyg5Q2gbA:38NHfdxziSo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=h3Xyg5Q2gbA:38NHfdxziSo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=h3Xyg5Q2gbA:38NHfdxziSo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=h3Xyg5Q2gbA:38NHfdxziSo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Tue, 12 Feb 2008 22:13:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:3d98005b-0ff6-4836-bd70-63e1db365ee9</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/h3Xyg5Q2gbA/install-ruby-memcached-on-macosx</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2008/02/12/install-ruby-memcached-on-macosx</feedburner:origLink></item>
    <item>
      <title>Scrubyt on Rails</title>
      <description>&lt;p&gt;If like me you have an error after installing scrubyt 0.3.4 (in console and launching mongrel):&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;can't activate RubyInline (= 3.6.3), already activated RubyInline-3.6.4]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I spent a lot of time to find the solution, and so easy solution &amp;#8230; anyway could be useful for people googling about this. You just need to unsinstall the lastest installed version of RubyInline:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo gem uninstall RubyInline -v 3.6.4&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Everything should be fine with this, even Scrubyt requiring version 3.6.3.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=g8J6dm6bKFA:KpvGHFMsNsY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=g8J6dm6bKFA:KpvGHFMsNsY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=g8J6dm6bKFA:KpvGHFMsNsY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=g8J6dm6bKFA:KpvGHFMsNsY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Tue, 16 Oct 2007 13:11:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:295e619d-9814-400e-8fa7-256326301ef2</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/g8J6dm6bKFA/scrubyt-on-rails</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2007/10/16/scrubyt-on-rails</feedburner:origLink></item>
    <item>
      <title>Scaling a Rails app (Part 2 of 3)</title>
      <description>&lt;p&gt;This the second part for a summary about solutions to help better computing of your rails app (&lt;a href="http://www.rubynaut.net/articles/2007/10/10/scaling-a-rails-app-part-1-of-3"&gt;1st part&lt;/a&gt;).&lt;/p&gt;


	&lt;h4&gt;Application&lt;/h4&gt;


	&lt;p&gt;To help your application to focus on replying fast to user, you can use a &lt;strong&gt;distributed queueing&lt;/strong&gt; to give the job to other processes:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://daemons.rubyforge.org/"&gt;Daemons&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://backgroundrb.rubyforge.org/"&gt;Backgroundrb&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;And second thing, you can &lt;strong&gt;cache&lt;/strong&gt; things you don&amp;#8217;t need to compute for each request, this can incredibly increase the response of your server, but need to modify your code and it s recommend for very big sites:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://seattlerb.org/memcache-client"&gt;Memcache client&lt;/a&gt;, &lt;a href="http://www.danga.com/memcached/"&gt;memcached server&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://errtheblog.com/post/27"&gt;acts_as_cached&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h4&gt;Back end&lt;/h4&gt;


	&lt;h5&gt;DB&lt;/h5&gt;


	&lt;p&gt;For your database you can find some &lt;strong&gt;sql proxy&lt;/strong&gt;, but I haven&amp;#8217;t tried it yet. You have also the way to &lt;strong&gt;replicate&lt;/strong&gt; your databse and serve data from several servers.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://sqlrelay.sourceforge.net/"&gt;sql relay&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;use jruby with a jdbc pool connection and caching&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Important things you have to check about your databse is if you have the right indexed fields. You should find some tools on mysql helping you to find where &lt;strong&gt;indexes&lt;/strong&gt; missing. Check about &lt;strong&gt;cache&lt;/strong&gt; too.&lt;/p&gt;


	&lt;p&gt;A last way is to &lt;strong&gt;serialize&lt;/strong&gt; some of your data in a single object.&lt;/p&gt;


	&lt;h5&gt;Mysql&lt;/h5&gt;


	&lt;p&gt;Otherwise you can configure your mysql with some optimized &lt;strong&gt;configuration&lt;/strong&gt; (mysql.ini):&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;skip-name-resolve&lt;/li&gt;
		&lt;li&gt;query_cache_size = 52428800;&lt;/li&gt;
		&lt;li&gt;query_cache_type = 1&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;And in your ActiveRecord object you can use the &lt;strong cite="include"&gt;* parameter.&lt;/p&gt;


	&lt;h5&gt;Filesystem&lt;/h5&gt;


	&lt;p&gt;Optimizing the filesystem, in other sense than choose a good OS, can been done with not overloading the management of files by using some *rules&lt;/strong&gt;:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;max 10K files / subdir&lt;/li&gt;
		&lt;li&gt;16 top level / 256 sub / 10K per sub dir&lt;/li&gt;
		&lt;li&gt;use a hasher to manage files&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h4&gt;OS&lt;/h4&gt;


	&lt;p&gt;As we have seen, file and memory management are keys of good performances. And these are managed by OS. The two best OSs mentionned are&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Sunsolaris&lt;/li&gt;
		&lt;li&gt;FreeBSD (can be use for a all in one stack), avoid the version 5&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;&lt;em&gt;And upcoming, last part of this article, some home made benchmarks for my own purpose.&lt;/em&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=JqD3fvb4CS4:UZN6QJ3TPMs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=JqD3fvb4CS4:UZN6QJ3TPMs:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=JqD3fvb4CS4:UZN6QJ3TPMs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=JqD3fvb4CS4:UZN6QJ3TPMs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Sun, 14 Oct 2007 14:18:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:20434bd3-6305-49bc-b677-1b5e76d84a77</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/JqD3fvb4CS4/railsconf-scaling-a-rails-app-part-2-of-3</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2007/10/14/railsconf-scaling-a-rails-app-part-2-of-3</feedburner:origLink></item>
    <item>
      <title>Scaling a Rails app (Part 1 of 3)</title>
      <description>&lt;p&gt;One of the most interesting topic in the RailsConf was &lt;em&gt;Scaling your Rails app&lt;/em&gt;. There are 2 ways of doing it:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;adapt your code&lt;/li&gt;
		&lt;li&gt;adapt your servers&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;But the second one will not help to make your code faster. It will just help to give maximum resources to compute it right.&lt;/p&gt;


	&lt;p&gt;Summaries from the conference (&lt;em&gt;sorry for the so few litterature it will be only a summarize&lt;/em&gt;):&lt;/p&gt;


	&lt;h3&gt;Some theories&lt;/h3&gt;


	&lt;p&gt;These theories are for big websites with millions of hits every month. This can involve thousand of servers, different location, ... &lt;span class="caps"&gt;BTW&lt;/span&gt; some tips can be use to help smaller configurations.&lt;/p&gt;


	&lt;p&gt;The 7 layers to be considered, &lt;em&gt;a la &lt;span class="caps"&gt;OSI&lt;/span&gt;&lt;/em&gt;. &lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;span class="caps"&gt;DNS&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;frontend &lt;/li&gt;
		&lt;li&gt;proxy&lt;/li&gt;
		&lt;li&gt;application server&lt;/li&gt;
		&lt;li&gt;application&lt;/li&gt;
		&lt;li&gt;backend (Db , filesystem)&lt;/li&gt;
		&lt;li&gt;OS&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h4&gt;&lt;span class="caps"&gt;DNS&lt;/span&gt;&lt;/h4&gt;


	&lt;p&gt;Nice website to check your &lt;span class="caps"&gt;DNS&lt;/span&gt; configuration: &lt;a href="http://www.dnsstuff.com/"&gt;dnsstuff.com&lt;/a&gt;
Good tool to optimize your &lt;span class="caps"&gt;DNS&lt;/span&gt;: speed, dispatching, and so on&amp;#8230;: &lt;a href="http://www.powerdns.com/"&gt;powerdns&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;DNS&lt;/span&gt; can be quite fast to address the right server from a request, scripts allow to manage complex configurations. The tip is to use 1 &lt;span class="caps"&gt;DNS&lt;/span&gt; entry per 1 controller, then managing part of the routing.&lt;/p&gt;


	&lt;h4&gt;Frontend and Proxy&lt;/h4&gt;


	&lt;p&gt;Load balancing is about dispatching requests taking in account the charge of each cluster.&lt;/p&gt;


	&lt;p&gt;Load balancers:
    &lt;a href="http://varnish.projects.linpro.no/"&gt;Varnish&lt;/a&gt;
    &lt;a href="http://haproxy.1wt.eu/"&gt;HAProxy&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Both look promising and HAProxy seems to be more and more popular.&lt;/p&gt;


	&lt;p&gt;Front end with load balancer:
    &lt;a href="http://wiki.codemongers.com/Main"&gt;Nginx&lt;/a&gt; : fast, low memory usage, http server with load balancing, easy configuration, very good in front of mongrel cluster.    
    Apache 2.2 + mod_proxy_balancer, you can find how to setup it in previous post: &lt;a href="http://www.rubynaut.net/articles/2007/09/22/apache-mongrel-cluster-rails-are-on-a-load-balancer"&gt;apapche, mongrel cluster, rails on a load balancer&lt;/a&gt;&lt;/p&gt;


	&lt;h4&gt;Application server&lt;/h4&gt;


	&lt;ul&gt;
	&lt;li&gt;mongrel server: enough for a personnal server
           gem install mongrel
           mongrel_rails start (&lt;a href="http://mongrel.rubyforge.org/docs/"&gt;more information&lt;/a&gt;)&lt;/li&gt;
		&lt;li&gt;mongrel_cluster: useful to scale up your configuration, need at least a multi-processor or multi server environnment.
           gem install mongrel_cluster 
           mongrel_rails cluster::configure &amp;#8230;
           mongrel_rails cluster::start&lt;/li&gt;
		&lt;li&gt;Evented Mongrel (&lt;a href="http://swiftiply.swiftcore.org/"&gt;swiftiply&lt;/a&gt;): it&amp;#8217;s a mongrel based an event triggering&lt;/li&gt;
		&lt;li&gt;jruby / glassfish: the technology java comes with some good environment to speed up part of your application like connection to database (jdbc, pool connection)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;&lt;em&gt;to be continued (application, backend, OS, and some home benchmark)&lt;/em&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=tU-H6Zfl184:RcHGHVZYR5g:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=tU-H6Zfl184:RcHGHVZYR5g:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=tU-H6Zfl184:RcHGHVZYR5g:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=tU-H6Zfl184:RcHGHVZYR5g:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Wed, 10 Oct 2007 20:32:53 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:471f1308-1501-4362-a631-494232b27410</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/tU-H6Zfl184/scaling-a-rails-app-part-1-of-3</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2007/10/10/scaling-a-rails-app-part-1-of-3</feedburner:origLink></item>
    <item>
      <title>Nginx and Mongrel cluster on debian</title>
      <description>&lt;p&gt;Nginx is a &amp;#8216;small&amp;#8217; efficient http, load balancer server. More and more popular in Rails community, it&amp;#8217;s a good front end for mongrel clusters. It&amp;#8217;s seems to be a good replacement for apache, at least for the memory usage (on my test: 1 process use 1.3M against the more than 9M taken by 1 apache process). Benchmark on one single server are quite similar.&lt;/p&gt;


	&lt;p&gt;The process has been tested on debian 4.0r1 and should work on Ubuntu.&lt;/p&gt;


	&lt;h3&gt;Installation&lt;/h3&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;or, if you want an up to date product:&lt;/p&gt;


	&lt;p&gt;1/ Prepare your system&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install zlib1g-dev libgcrypt11-dev libpcre3-dev libssl-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;2/ &lt;a href="http://sysoev.ru/nginx/download.html"&gt;Download source&lt;/a&gt;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;tar xzf nginx-0.6.12.tar.gz
cd nginx-0.6.12&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;3/ Compile it&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;./configure --pid-path=/usr/local/nginx/logs/nginx.pid \
    --sbin-path=/usr/local/sbin/nginx \
    --with-md5=/usr/lib \
    --with-sha1=/usr/lib \
    --with-http_ssl_module \
    --with-http_dav_module --prefix=/usr \
    --conf-path=/etc/nginx/nginx.conf \
    --pid-path=/var/run/nginx.pid \
    --lock-path=/var/run/nginx.lock \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log 

make

sudo make install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Configuration&lt;/h3&gt;


	&lt;p&gt;The following configuration is for 1 nginx server with load balancing 3 mongrel in cluster:&lt;/p&gt;


	&lt;p&gt;1/ Mongrel cluster configuration&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;gem install mongrel_cluster -y

cd /var/www/my-app-path/current/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;configures 3 mongrel in cluster, in production mode, starting at port 5000 and listening on localhost&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo mongrel_rails cluster::configure -e production \
    -p 5000 -N 3 -c /var/www/my-app-path/current/ -a 127.0.0.1 \
    --user www-data

mongrel_rails cluster::start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;2/ Nginx&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;nano /etc/nginx.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Use the &lt;a href="http://brainspl.at/nginx.conf.txt"&gt;nginx.conf&lt;/a&gt; file from &lt;a href="http://brainspl.at/"&gt;brainspl.at&lt;/a&gt; website, change the 2 or 4 (if you use ssl) references to the path of your application (/var/www/my-app-path/current/)&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;/etc/init.d/nginx start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;All these information come from many website (thanks to all), I put them together for my own usage, hope it&amp;#8217;s helpfull.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=hDbe_WxHsvM:FPuVFpVtxEQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=hDbe_WxHsvM:FPuVFpVtxEQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Rubynaut?a=hDbe_WxHsvM:FPuVFpVtxEQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Rubynaut?i=hDbe_WxHsvM:FPuVFpVtxEQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Sun, 23 Sep 2007 18:24:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:9166bf4a-f5fb-47bc-a811-5f0b1cde8ff0</guid>
      <author>stephane</author>
      <link>http://feedproxy.google.com/~r/Rubynaut/~3/hDbe_WxHsvM/nginx-and-mongrel-cluster-on-debian</link>
    <feedburner:origLink>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian</feedburner:origLink></item>
  </channel>
</rss>
