send_file and very large files

370 views
Skip to first unread message

theG

unread,
Apr 23, 2010, 4:14:27 PM4/23/10
to sinatrarb
Hi

I am using sinatra and send_file for a download process. Versions as
below

[2010-04-23 20:51:43] INFO WEBrick 1.3.1
== Sinatra/1.0 has taken the stage on 8030 for development with backup
from WEBrick
[2010-04-23 20:51:43] INFO ruby 1.9.1 (2009-12-07) [x86_64-linux]

When i serve a large file say 500MB, sinatra seems to take ages to
start 'streaming' it. ie. in IE and FF the prompt does not come up for
a while (or not at all).

Now i read something about streaming and send_file is supposed to
chunk 8K or something. But it doesn't look like it's working. Also i
read about proxying the request to say apache.

1) is something wrong with send_file ?
2) how do you do the proxying thing to apache. i need the external url
to not detect the fact that something else is serving the file
obviously

thanks,

--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To post to this group, send email to sina...@googlegroups.com.
To unsubscribe from this group, send email to sinatrarb+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sinatrarb?hl=en.

theG

unread,
Apr 28, 2010, 4:17:11 PM4/28/10
to sinatrarb
bump!

Nick M

unread,
May 4, 2010, 3:05:26 PM5/4/10
to sinatrarb
I was also seeing the same thing. After a bit of exploring, I think
this is only a problem with Webrick and Thin. If you run Mongrel or
Passenger, send_file should work properly and stream the contents of
the file without first reading it all into memory. Perhaps this caveat
could be documented in send_file's API docs?

Here's a thread about Thin's issue with Rack and streaming files:
http://groups.google.com/group/thin-ruby/browse_thread/thread/4762f8f851b965f6

Nick

theG

unread,
Jun 9, 2010, 6:12:21 PM6/9/10
to sinatrarb
ok thanks will give this a go

On May 4, 8:05 pm, Nick M <nick.muerd...@gmail.com> wrote:
> I was also seeing the same thing. After a bit of exploring, I think
> this is only a problem with Webrick and Thin. If you run Mongrel or
> Passenger, send_file should work properly and stream the contents of
> the file without first reading it all into memory. Perhaps this caveat
> could be documented in send_file's API docs?
>
> Here's a thread about Thin's issue with Rack and streaming files:http://groups.google.com/group/thin-ruby/browse_thread/thread/4762f8f...

theG

unread,
Jun 10, 2010, 6:26:16 PM6/10/10
to sinatrarb
it seemed to have worked. i had to patch one of the source files in
mongrel under ruby 1.9.1.
cheers
Reply all
Reply to author
Forward
0 new messages