[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: webrick fails with large files

Daniel Sheppard

2/28/2007 1:01:00 AM

> Eric Hodel wrote:
> > On Feb 27, 2007, at 13:36, Roger Pack wrote:
> >
> >> So...apparently webrick does the following for serving pages:
> >> loads the page into a string object
> >> then sends that string to the requestor.
> >> Unfortunately this means that if it is a very large file
> being served
> >> that that buffer string will get very large.
> >
> > Don't dynamically build and send large strings. Use an IO instead.
> > WEBrick knows the difference and responds accordingly.
>
> I believe that rails must use strings, then--any ideas for that case?
> Thanks!

Don't use webrick for any serious hosting - sending out a 700mb file
constitutes serious hosting.

I'd say your best approach would be to setup a mongrel cluster running
behind apache and then either a:

a) let apache serve the file and never hit ruby code

or

b) install mod_x_sendfile into apache and just have your code set the
appropriate header to let apache do the lifting.

You could also do the same thing behind lighttpd. There's many howtos
about on lighttpd+mongrel and apache+mongrel - google about.

Dan.