Hi, on my site I have several screen casts (using flash video flv) in addition to the normal rails application which is the core service, my setup is apache proxy/balancing to 2 mongrels. I was thinking I should probably not be serving up streaming video from mongrel as it will occupy the mongrel processes for long periods of time right? So I was thinking of excluding a directory from the proxy and serving videos up from apache. Does anyone have an example of how to do this and or agree its a good idea to not serve the videos from mongrel and offload this work to apache? thanks Joel
Well, based on your setup, and if you copied one of the examples on the web already, you should be serving the video from apache anyway already. If not, there are plenty of examples on the web you can search for "apache mongrel" The main one is http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/ Add in checks for .flv files that exist and it should then be served by apache. Also, you could store the files in a directory that isn''t under the mongrel proxy and have apache sent that, or use xsendfile. On 9/13/07, Joel Nylund <jnylund at yahoo.com> wrote:> Hi, on my site I have several screen casts (using flash video flv) in > addition to the normal rails application which is the core service, > my setup is apache proxy/balancing to 2 mongrels. > > I was thinking I should probably not be serving up streaming video > from mongrel as it will occupy the mongrel processes for long periods > of time right? > > So I was thinking of excluding a directory from the proxy and serving > videos up from apache. > > Does anyone have an example of how to do this and or agree its a good > idea to not serve the videos from mongrel and offload this work to > apache? > > thanks > Joel > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
You can use X-Sendfile. Your mongrel / ruby application simply sends back a X-Sendfile header pointing to the local file that you want to download to the user. The web-server then takes over and streams the file to the server, and your mongrel process gets to continue without having to wait for the download. I use it with Lighttpd 1.5, and it works very well. From what I hear, this is also possible with Apache. This lets you have some security of download + still have speed. -Pete On Sep 13, 2007, at 8:47 AM, Joel Nylund wrote:> Hi, on my site I have several screen casts (using flash video flv) in > addition to the normal rails application which is the core service, > my setup is apache proxy/balancing to 2 mongrels. > > I was thinking I should probably not be serving up streaming video > from mongrel as it will occupy the mongrel processes for long periods > of time right? > > So I was thinking of excluding a directory from the proxy and serving > videos up from apache. > > Does anyone have an example of how to do this and or agree its a good > idea to not serve the videos from mongrel and offload this work to > apache? > > thanks > Joel > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users