Rodrigo Rosenfeld Rosas
2011-Sep-02 22:07 UTC
Is Rails 3.1 still lacking real streaming support?
I remember that some time ago I did want to generate an HTML table in which each row would take several seconds for generating each line. And I wanted to be able to view the generated HTML file as the rows were processed. At that time, Rails didn''t support this. Am I right in assuming that even Rails 3.1 won''t support this kind of streaming support? I mean, consider that my view won''t set any variables for the layout to be aware about. So the layout would be just plain HTML with a single "yield". Then, I would like to be able to send my response as they are generated. Is that kind of support planned to be added in some later version of Rails? Cheers and have a good weekend and holiday for those in USA, Rodrigo. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On Sat, Sep 3, 2011 at 12:07 AM, Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> wrote:> I remember that some time ago I did want to generate an HTML table in which > each row would take several seconds for generating each line. > > And I wanted to be able to view the generated HTML file as the rows were > processed. > > At that time, Rails didn''t support this. Am I right in assuming that even > Rails 3.1 won''t support this kind of streaming support? > > I mean, consider that my view won''t set any variables for the layout to be > aware about. So the layout would be just plain HTML with a single "yield".In 3.1, only the layout is streamed, so the table would be buffered. In addition to that, producion setups have gotchas. For example, if you use nginx + Unicorn with the recommended configuration, streaming will technically work, but it only gets to nginx who buffers the entire response. So in practice the client is not seeing the benefits. In addition to that, the proxy of ngnix is 1.0, so it sends a 1.0 request to the proxied server. And Rails disables streaming for 1.0 requests because it is a 1.1 feature. They were trying to come with a workaround for that somehow, not sure which is the situation as of today. There''s also the problem with compression, if you have it enabled (which is a standard practice in normal production setups). The web server should be able to dechunk, compress, and chunk the compressed content, everything on the fly. The only combo that worked for me when I did research about this a few weeks ago was Apache + Unicorn. Hongli was also working on it for Passenger, I don''t know which is the status right now. In general, this feature has to be considered experimental today.> Then, I would like to be able to send my response as they are generated. Is > that kind of support planned to be added in some later version of Rails?Yes, it is in the radar, perhaps in some future version. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
[Reposting this because it does not seem to arrive, please excuse if you get it twice.] On Sep 3, 12:07 am, Rodrigo Rosenfeld Rosas <rr.ro...@gmail.com> wrote:> I remember that some time ago I did want to generate an HTML table in > which each row would take several seconds for generating each line. > > And I wanted to be able to view the generated HTML file as the rows were > processed. > > At that time, Rails didn''t support this. Am I right in assuming that > even Rails 3.1 won''t support this kind of streaming support? > > I mean, consider that my view won''t set any variables for the layout to > be aware about. So the layout would be just plain HTML with a single > "yield".In 3.1, only the layout is streamed, so the table would be buffered. In addition to that, producion setups have gotchas. For example, if you use nginx + Unicorn with the recommended configuration, streaming will technically work, but it only gets to nginx who buffers the entire response. So in practice the client is not seeing the benefits. In addition to that, the proxy of ngnix is 1.0, so it sends a 1.0 request to the proxied server. And Rails disables streaming for 1.0 requests because it is a 1.1 feature. They were trying to come with a workaround for that somehow, not sure which is the situation as of today. There''s also the problem with compression, if you have it enabled (which is a standard practice in normal production setups). The web server should be able to dechunk, compress, and chunk the compressed content, everything on the fly. The only combo that worked for me when I did research about this a few weeks ago was Apache + Unicorn. Hongli was also working on it for Passenger, I don''t know which is the status right now. In general, this feature has to be considered experimental today.> Then, I would like to be able to send my response as they are generated. > Is that kind of support planned to be added in some later version of Rails?Yes, it is in the radar, perhaps in some future version. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Rodrigo Rosenfeld Rosas
2011-Sep-03 03:49 UTC
Re: Re: Is Rails 3.1 still lacking real streaming support?
Wow, Xavier, thank you very much for the detailed status report of the current situation of streaming support in Rails and Ruby servers :) I appreciate that a lot! Cheers, Rodrigo. Em 02-09-2011 20:10, Xavier Noria escreveu:> [Reposting this because it does not seem to arrive, please excuse if > you get it twice.] > > On Sep 3, 12:07 am, Rodrigo Rosenfeld Rosas<rr.ro...@gmail.com> > wrote: > >> I remember that some time ago I did want to generate an HTML table in >> which each row would take several seconds for generating each line. >> >> And I wanted to be able to view the generated HTML file as the rows were >> processed. >> >> At that time, Rails didn''t support this. Am I right in assuming that >> even Rails 3.1 won''t support this kind of streaming support? >> >> I mean, consider that my view won''t set any variables for the layout to >> be aware about. So the layout would be just plain HTML with a single >> "yield". > In 3.1, only the layout is streamed, so the table would be buffered. > > In addition to that, producion setups have gotchas. For example, if > you use nginx + Unicorn with the recommended configuration, streaming > will technically work, but it only gets to nginx who buffers the > entire response. So in practice the client is not seeing the benefits. > > In addition to that, the proxy of ngnix is 1.0, so it sends a 1.0 > request to the proxied server. And Rails disables streaming for 1.0 > requests because it is a 1.1 feature. They were trying to come with a > workaround for that somehow, not sure which is the situation as of > today. > > There''s also the problem with compression, if you have it enabled > (which is a standard practice in normal production setups). The web > server should be able to dechunk, compress, and chunk the compressed > content, everything on the fly. The only combo that worked for me when > I did research about this a few weeks ago was Apache + Unicorn. Hongli > was also working on it for Passenger, I don''t know which is the status > right now. > > In general, this feature has to be considered experimental today. > > >> Then, I would like to be able to send my response as they are generated. >> Is that kind of support planned to be added in some later version of Rails? > Yes, it is in the radar, perhaps in some future version. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.