Search code examples
ruby-on-railsnginxstreamingthinsendfile

nginx doesn't stream file through thin runned rails app


Ive a rails 4 app running which is used for file exchange. Its basicly running very well but when I try to download a file that is bigger then some hundred mb its getting slow. I think this is because nginx doenst stream the file it's first loading the file to the ram and then sends it.

I have sendfile on; in my nginx config and config.action_dispatch.x_sendfile_header set to true in my config/environments/production.conf. Im using thin as a webserver.

Does anyone have an idea about what Im doing wrong?


Solution

  • I don't think thin supports Rails implementation of streaming out of the box.

    There was some work done on that front, but afaik it was never merged to master branch.

    Instead of thin, our team switched to using puma on our local machines, and we're using passenger on our production server (although in the light of recent article from Engine Yard, we're considering switching our production app server to either unicorn on puma).