# X-sendfile horrendously slow?

**URL:** <https://www.ruby-forum.com/t/x-sendfile-horrendously-slow/107424>\
**Category:** Rails\
**Created:** [June 21, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/x-sendfile-horrendously-slow/107424 "2007-06-21T18:08:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@pdovy](https://www.ruby-forum.com/u/pdovy)\
**Post date:** [June 21, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/x-sendfile-horrendously-slow/107424/1 "2007-06-21T18:08:05Z")

</div>

I’m using Camping (though I suspect this applies to RoR just as well,  
and if you have an RoR specific answer I’d be happy to hear it, I may  
switch) to do a number of things for an internal application, one of  
which is transferring large files (~2GB each) between machines over the  
network. I thought the easy route would just be to make an app that  
when given the filename, serves you the file with the x-sendfile header.  
However this is proving to be very, very, slow - I can transfer files  
via SCP at about 30 mb/s over the network, whereas via Camping the file  
is served at about 4 mb/s.

I’m running on WEBrick with Ruby 1.8.6. Any thoughts on what the issue  
is? It seems like Ruby is doing a lot more work than it needs to, I  
don’t know if it’s WEBrick (I’ve heard it is slow) or what.

Thanks!

---

<div class="post-metadata">

**Author:** ![pdovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@pdovy](https://www.ruby-forum.com/u/pdovy)\
**Post date:** [June 22, 2007, 3:34am UTC](https://www.ruby-forum.com/t/x-sendfile-horrendously-slow/107424/2 "2007-06-22T03:34:15Z")

</div>

On 6/21/07, pdovy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m running on WEBrick with Ruby 1.8.6. Any thoughts on what the issue  
> is? It seems like Ruby is doing a lot more work than it needs to, I  
> don’t know if it’s WEBrick (I’ve heard it is slow) or what.

You’ll want to use another web server like nginx/apache/lighttpd.  
They all have slightly different methods of doing this. nginx has the  
X-Accel-Redirect, apache has mod\_sendfile, lighttpd has  
mod\_secdownload…? I’m more familiar with nginx, but this should  
provide some valid keywords to google. Good luck!

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)
