[Mongrel] static file serving

Ezra Zygmuntowicz ezmobius at gmail.com
Thu Feb 15 23:02:24 EST 2007


On Feb 15, 2007, at 7:22 PM, Joe Van Dyk wrote:

> Hi,
>
> I've got 40 mongrels running across 4 machines with a hardware load
> balancer as a proxy.  The mongrels serve everything, even files.
>
> How screwed am I if I have a 2MB file on my site?  Say 40 people are
> downloading that file.  Are the mongrels completely locked up?
>
> Joe
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>


	Joe, Mongrel serves static files outside of the mutex lock, this  
means one mongrel can serve concurrent static files. If you are  
sending a file with send_file or send_data it might be a problem, but  
if it's just all the static assets of your site then it will be fine  
if 40 people download the file at once you will still be able to  
serve traffic.

	However it is horribly ineficient to serve static files with  
mongrel, since your mongrels will be working hard at serving static  
files at the same time they serve dynamic content. I think you should  
probably run one static file webserver on one of your boxes and use  
rails asset_host feature to send static content to a static server.  
Or you could ask for rewrite rules to be put in place on the load  
balancer to rewrite anything with /images/, /stylesheets/ and / 
javascripts/ in the url to be served by the static asset server.


Cheers-
-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)




More information about the Mongrel-users mailing list