3

I have a Rails 3 project that does file upload/download, with access rights (User has many Files, and can only read/write his own files).

If I store my files on classic filesystem, I can check the access to the file in my rails app and then use X-Sendfile header to redirect to the file, if user has access. In this way, a user can never access a file without permission, and the download is fast.

  1. Can I make file download from GridFS as fast as X-Sendfile, and skip the hassle of piping them trough rails/rack ?

  2. Piping them trough rails/rack would be horribly slow ?

  3. Can I make file download from GridFS as fast as X-Sendfile, and skip the hassle of piping them trough rails/rack, AND ALSO have the ability to enforce access rights ?

clyfe
  • 23,695
  • 8
  • 85
  • 109
  • guess I'll just use something like [rack-gridfs](http://github.com/skinandbones/rack-gridfs) and prey it's fast – clyfe Oct 29 '10 at 20:53

1 Answers1

1

Up until now I've found and thought of to possible solutions:

  1. Use something like gridfs-fuse to mount the GFS to local FS and use X-Sendfile just as allways.

  2. Use something like nginx-gridfs which is c-fast and out-of-rails (does not block my app's req-resp cycle while downloading). The downside is that it's server specific

clyfe
  • 23,695
  • 8
  • 85
  • 109
  • nginx-gridfs looks like a nice solution, however the current version fails to compile and due to many issues it might suffer from memory leaks. I would be very careful with using it in production – Tombart May 10 '12 at 19:08