Hii All, i loaded mod_xsendfile.so in apche , i added few line in httpd.conf files LoadModule xsendfile_module modules/mod_xsendfile.so XSendFile on XSendFileAllowAbove on <VirtualHost * localhost:80> ServerName src DocumentRoot C:/InstantRails-2.0-win/rails_apps/src/public/ ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ </VirtualHost > now in my rails application i have a streams controller and inside streams controller i have a function named download ,code for code download is below def download @stream = Stream.find(params[:id]) filename = "#{@stream.location}" response.headers[''Content-Type''] = "application/force-download" response.headers[''Content-Disposition''] = "attachment; filename=\"#{File.basename(filename)}\"" response.headers["X-Sendfile"] = @stream.location response.headers[''Content-length''] = File.size(filename) render :nothing => true end Problem is my rails application still handling this request but i would like apache to handle this request ,can anyone tell me how i configure apche to handle this request?? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 27, 9:00 am, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Problem is my rails application still handling this request but i would > like apache to handle this request ,can anyone tell me how i configure > apche to handle this request??So what happens when you hit that controller ? (and did you notice that rails'' send_file method has an x_sendfile option) Fred> -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Sep 27, 9:00?am, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Problem is my rails application still handling this request but i would >> like apache to handle this request ,can anyone tell me how i configure >> apche to handle this request?? > > So what happens when you hit that controller ? (and did you notice > that rails'' send_file method has an x_sendfile option) > > FredFred thanks for responding Actully when i downloding files,mongrel rendering things, Processing StreamsController#download (for 127.0.0.1 at 2010-09-27 16:50:47) [GET] Parameters: {"id"=>"6655"} ?[4;36;1mSQL (0.0ms)?[0m ?[0;1mSET NAMES ''utf8''?[0m ?[4;35;1mSQL (0.0ms)?[0m ?[0mSET SQL_AUTO_IS_NULL=0?[0m ?[4;36;1mStream Columns (0.0ms)?[0m ?[0;1mSHOW FIELDS FROM `streams`?[0m ?[4;35;1mStream Load (0.0ms)?[0m ?[0mSELECT * FROM `streams` WHERE (`streams`.`id` = 6655) ?[0 Completed in 78ms (View: 0, DB: 0) | 200 OK [http://src/streams/download/6655] It is when i am trying to download 2.2GB of file ,file is downloaded completely,but my worry is why mongrel is rendering things if apache is handling download -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 27, 12:28 pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> It is when i am trying to download 2.2GB of file ,file is downloaded > completely,but my worry is why mongrel is rendering things if apache is > handling downloadThat looks entirely normal to me - your rails code does need to be invoked at some point in order for it to tell apache which file to send. Fred> -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Sep 27, 12:28?pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> It is when i am trying to download 2.2GB of file ,file is downloaded >> completely,but my worry is why mongrel is rendering things if apache is >> handling download > > That looks entirely normal to me - your rails code does need to be > invoked at some point in order for it to tell apache which file to > send. > > FredBut Fred lot of experts are saying ,mongerl doesn''t render anything while apche handle the request and one more thing how do i make sure apache is handling is request?? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Monday 27 September 2010, Amit Tomar wrote:> Frederick Cheung wrote: > > On Sep 27, 12:28?pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> It is when i am trying to download 2.2GB of file ,file is > >> downloaded completely,but my worry is why mongrel is rendering > >> things if apache is handling download > > > > That looks entirely normal to me - your rails code does need to be > > invoked at some point in order for it to tell apache which file to > > send. > > > > Fred > > But Fred lot of experts are saying ,mongerl doesn''t render anything > while apche handle the request and one more thing how do i make sure > apache is handling is request??Amir, I''m not sure, but you might be misunderstanding what xsendfile is for and how it works. This mechanism is not intended to serve "ordinary" static files located in the public directory of an application. Rather, it is a way for your controller to hand off serving a file to Apache instead of doing it from within Rails. So, your controller *has* to be involved. It''s the job of the controller action to decide which file to return in the response and then call send_file with that file as a parameter. In the production environment, this has the effect that the Rails process does not respond with the file itself. Instead, Rails sets a special header which in turn is picked up by Apache (or nginx, lighttpd) and interpreted in such a way that it now serves the named file. Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Schuerig wrote:> On Monday 27 September 2010, Amit Tomar wrote: >> > Fred >> >> But Fred lot of experts are saying ,mongerl doesn''t render anything >> while apche handle the request and one more thing how do i make sure >> apache is handling is request?? > > Amir, I''m not sure, but you might be misunderstanding what xsendfile is > for and how it works. This mechanism is not intended to serve "ordinary" > static files located in the public directory of an application. Rather, > it is a way for your controller to hand off serving a file to Apache > instead of doing it from within Rails. > > So, your controller *has* to be involved. It''s the job of the controller > action to decide which file to return in the response and then call > send_file with that file as a parameter. In the production environment, > this has the effect that the Rails process does not respond with the > file itself. Instead, Rails sets a special header which in turn is > picked up by Apache (or nginx, lighttpd) and interpreted in such a way > that it now serves the named file. > > Michael > > -- > Michael Schuerig > mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org > http://www.schuerig.de/michael/Thanks michel but michel i downloaded 3.2 gb of streams,but when i trying download 4 gb of stream ,i am getting only 10 mb of data... what could be the problem is there any restriction on file size to be served using apache mod_xsendfile.so module -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 27, 2:30 pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thanks michel > but michel i downloaded 3.2 gb of streams,but when i trying download 4 > gb of stream ,i am getting only 10 mb of data... > what could be the problem > is there any restriction on file size to be served using apache > mod_xsendfile.so > moduleWell the version history for mod_xsendfile says that version 0.11 fixed large file support, so i''d check you''ve got that version. Release notes for apache 2.2 state "httpd is now built with support for files larger than 2GB on modern 32-bit Unix systems. Support for handling >2GB request bodies has also been added." (http:// httpd.apache.org/docs/2.2/new_features_2_2.html), so I''d also check you''ve got that. ( according to http://instantrails.rubyforge.org/wiki/wiki.pl?Release_Notes_For_Instant_Rails_2.0 instantrails 2 uses apache 1.3.33) Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Sep 27, 2:30?pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Thanks michel >> but michel ?i downloaded 3.2 gb of streams,but when i trying download 4 >> gb of stream ,i am getting only 10 mb of data... >> what could be the problem >> is there any restriction on file size to be served using apache >> mod_xsendfile.so >> module > > Well the version history for mod_xsendfile says that version 0.11 > fixed large file support, so i''d check you''ve got that version. > Release notes for apache 2.2 state "httpd is now built with support > for files larger than 2GB on modern 32-bit Unix systems. Support for > handling >2GB request bodies has also been added." (http:// > httpd.apache.org/docs/2.2/new_features_2_2.html), so I''d also check > you''ve got that. ( according to > http://instantrails.rubyforge.org/wiki/wiki.pl?Release_Notes_For_Instant_Rails_2.0 > instantrails 2 uses apache 1.3.33) > > FredThanks fred.. but Fred i m on windows machine ,and not able to compile mod_xsendfile.c using apxs because i don''have apxs installedon windows could you please help me out in installing apxs on windows an i also trying to include mod_xsendfile.so directly in httpd.conf but failed in doing so.. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> > Thanks fred.. > but Fred i m on windows machine ,and not able to compile > mod_xsendfile.c using apxs because i don''have apxs installedon windows > could you please help me out in installing apxs on windows an i also > trying > to include mod_xsendfile.so directly in httpd.conf but failed in doing > so..and can get direct mod_xsendfile.so for version 0.11 without compiling the source because the mod_sendfile.so am using now ,got directly Thanks for your kind support... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 27, 4:25 pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thanks fred.. > but Fred i m on windows machine ,and not able to compile > mod_xsendfile.c using apxs because i don''have apxs installedon windows > could you please help me out in installing apxs on windows an i also > trying > to include mod_xsendfile.so directly in httpd.conf but failed in doing > so..Afraid I''m not a windows user (also I''ve no idea what version of mod_xsendfile you currently have - that may not be the problem) Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Sep 27, 4:25?pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Thanks fred.. >> but Fred i m on windows machine ,and not able to compile >> mod_xsendfile.c using apxs because i don''have apxs installedon windows >> could you please help me out in installing apxs on windows an i also >> trying >> to include mod_xsendfile.so directly in httpd.conf but failed in doing >> so.. > > Afraid I''m not a windows user (also I''ve no idea what version of > mod_xsendfile you currently have - that may not be the problem) > > Fredyaa Fred you are 100% right what you said about mod_xsendfile version issue i loaded 0.11 version in apache cong file and able to download 4.2 GB of file but it took 30 min. don''t you think its huge time. Is there any way to reduce time ,takes to serve files Thanks for your help...... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 28, 12:24 pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote:> yaa Fred you are 100% right what you said about mod_xsendfile version > issue > i loaded 0.11 version in apache cong file and able to download 4.2 GB of > file > but it took 30 min. don''t you think its huge time. > Is there any way to > reduce time ,takes to serve files >That''s averaging 1.8MB/s which seems pretty fast to me. Fred> Thanks for your help...... > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.