Passenger, Memory and mod_rewrite

Well, as I stated in my previous post, I enabled Passenger for my Austin Real Estate site.  Well, everything seemed fine for the first few days.  But then I noticed that my memory usage was steadily creeping up.  I killed my ruby processes and that helped but then it just started creeping up again.  After working with Dreamhost, they discovered there was a bug in that version of Passenger and they upgraded it for me and now my memory usage is much lower and holding steady.  However, I have another problem.  Apparently Passenger disables mod_rewrite.  This is fine since Passenger doeesn’t need it to run your Rails app.  However, I also had a wordpress instance on my domain.  I used a mod_rewrite to redirect users to the blog instead of Rails trying to interpret the url.  This no longer works and now my blog is dead.  I have several options to fix this.  After much deliberating, I have decided to move my Rails app to a subdomain,  I will keep the blog on the main domain as it has most of the content. So, all in all, I am still satisfied with Passenger, but it does pay to do a little research before making major changes to your site.

Optimizing Rails Server Performance on Dreamhost

Lately, I have been working on some SEO for my Austin Real Estate site.  Slowly but surely my traffic has been increasing so I figured it was time for me to solve some long standing issues before my site gets too busy.  It is hosted on Dreamhost and has been pretty slow.  I built the site in Rails and it was my first production site built using Rails so I figured my ignorance with developing in Rails was causing the problem.  I did a lot of reading and optimized my code and environment as much as possible and it really didn’t seem to help much.

So I came to the conclusion that it was my host.  Dreamhost has been very open about how they feel about hosting Rails on a shared server.  DHH obviously disagrees.  But recently Dreamhost started offering a solution.  They now offer dedicated virtual hosting plans.  I decided to try it.  Mine was finally set up a couple of days ago.  Well my site immediately crashed.  Awesome.  My memory usage was constantly running too high.  I bumped up my memory allowance and the site became stable again and actually ran a bit faster.  However, I still wasn’t satisfied.  So then I tried setting up a Mongrel server which Dreamhost started offering along with the virtual servers.  I wasn’t too impressed.  So what was next?  Well Dreamhost also recently started offering Passenger as a Rails hostiing option.  I disabled the Mongrel and turned on Passenger.  The memory usage immediately dropped and the site had a noticeable speed increase.  I think I finally found my answer.  This was all a very unscientific series of tests by a complete novice sysadmin but I think the site is much better off.  Time will tell.