Rails 3.1中的HTTP流是否适用于Thin?

时间:2011-05-24 05:46:33

标签: ruby-on-rails thin unicorn ruby-on-rails-3.1

Rails 3.1支持HTTP流式传输,但仅支持兼容的Web服务器。宣布3.1版本候选人的博客文章提到Unicorn: http://weblog.rubyonrails.org/2011/5/22/rails-3-1-release-candidate

API文档也提到了Unicorn,并为Passenger提供了一个存根: https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/streaming.rb

有人知道是否支持Thin,如果有,我可以在哪里找到配置信息?

1 个答案:

答案 0 :(得分:1)

在0.5.4版本的发行说明中:

    == 0.5.4 Flying Mustard release
     * Don't read the full body, use direct streaming when sending response.
       See: Response#each
       As a result, the Content-Length can not be calculated anymore.
       You have to do set this in your adapter. All frameworks do it anyway.
       It improve memory usage and boost speed for low concurrency.
       Thanks to Kent Sibilev and Ezra for their help on that one.

然而,当我运行两个瘦实例(在不同的端口上,一组设置为资产主机)时,在控制器操作中的sleep调用完成执行之前,未加载布局中的CSS和JS。这是在生产模式下完成的。

我不是百分之百确定它的机制,也许需要设置Thin机架适配器以允许流式传输。