I''ve got an app serving images on the filesystem from outside the /public directory so I can authenticate users first. I''m serving the images and thumbnails up using send_file, (1 large 60k image and 9 6k thumbnails) in one view, and it seems a bit sluggish. Is this just because of my crappy old windows box running in development mode - or is each request to serve up an image from an action in the controller slowing the app down? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Action caching will help improve matters, but if you need to authenticate for every image, you are already in a bad place for performance. Lighttpd and I''m sure other servers have a way of serving ''secure'' downloads. This works by putting a token into the URL for each image when you generate the HTML. This token will expire shortly, so only that user will be able to read those images. The images are then served directly by the web server (but only if the token is valid). I''ve seen this technique used for downloading purchased MP3 files, and it worked as advertised. More info (including a Rails example) at the mod_secdownload page: http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload On Mar 13, 3:39 am, Robbie Shepherd <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''ve got an app serving images on the filesystem from outside the > /public directory so I can authenticate users first. > > I''m serving the images and thumbnails up using send_file, (1 large 60k > image and 9 6k thumbnails) in one view, and it seems a bit sluggish. Is > this just because of my crappy old windows box running in development > mode - or is each request to serve up an image from an action in the > controller slowing the app down? > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks Tom - after some more research it appears that Mongrel (which I''m using) seems to be playing a large part in the problem. I read about using lighttpd and the X-send-file header, which might work better. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have a plugin that extends Rails Action Caching to use the X- Sendfile header on lighttpd or the equivalent on nginx to send the cached file, so your Rails code only needs to care about action caching, and all the magic will be enabled by the server configuration. More info here: http://agilewebdevelopment.com/plugins/action_cache On Mar 13, 10:18 pm, Robbie Shepherd <rails-mailing-l...@andreas- s.net> wrote:> thanks Tom - after some more research it appears that Mongrel (which I''m > using) seems to be playing a large part in the problem. I read about > using lighttpd and the X-send-file header, which might work better. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There''s a gem that is supposed to take care of this on Mongrel, although I haven''t tried it. We''re about to tackle the same issue so if you use this and it works for you would you mind dropping us a line? http://rubyforge.org/projects/msend-file/ Dale On Mar 13, 9:18 pm, Robbie Shepherd <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> thanks Tom - after some more research it appears that Mongrel (which I''m > using) seems to be playing a large part in the problem. I read about > using lighttpd and the X-send-file header, which might work better. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---