如何使用的Apache2和mod_proxy_fcgi禁用缓冲? [英] How to disable buffering with apache2 and mod_proxy_fcgi?
问题描述
我在Debian杰西与我的C ++应用程序,确实ServerSentEvents与libfcgipp使用mod_proxy_fcgi与Apache 2.4。
I'm using mod_proxy_fcgi with apache 2.4 on a debian Jessie with my C++ application which does ServerSentEvents with libfcgipp.
我的问题是,阿帕奇仍然缓存我的响应数据。我确认它不是由libfcgipp库使用Wireshark的缓冲:通过产卵-FCGI
启动FCGI应用程序后,得到的数据立即发送到Apache Web服务器越好。但是,在我的浏览器(我用于测试,稍后会有一个C ++客户端)之后我封杀只显示/关闭服务器应用程序发送的请求。
My problem is, that apache still buffers my response data. I confirmed that it isn't buffered by the libfcgipp library by using wireshark: After starting the fcgi application via spawn-fcgi
, the data gets send to the apache web server as soon as possible. But in my browser (which I use for testing, later there will be a C++ client) it only shows up after I "killed"/closed the sending request in the server application.
所以,我认为我需要禁用缓存为Apache或mod_proxy_fcgi(或两者)。但我不能找到如何做到这一点相应的文档。
So I assume I need to disable buffering for either apache or mod_proxy_fcgi (or both). But I cannot find the appropriate documentation on how to do this.
推荐答案
的几个注意事项,因为我只花了几个小时尝试找到这个问题的答案:
A few notes, since I just spent the past few hours experimenting to find the answer to this question:
- 这是不可能的完全的使用时,禁止输出缓冲
的mod_proxy
/mod_proxy_fcgi
,但是,您可以仍然在流块响应。 - 看来,根据我的实验,该块具有为至少4096字节之前输出将被刷新到浏览器。
- 您的可以的禁用与
的mod_fastcgi
或mod_fcgi
模块的输出缓冲,但那些MODS不是流行/广泛使用Apache 2.4使用。 - 如果您有
mod_deflate模块
启用,并且没有设置SETENV无gzip的1
为虚拟主机/目录/等等这是流数据,然后gzip的将不允许缓冲器刷新,直到请求完成。
- It's not possible to entirely disable output buffering when using
mod_proxy
/mod_proxy_fcgi
, however, you can still have responses streamed in chunks. - It seems, based on my experimentation, that chunks have to be at least 4096 bytes before the output will be flushed to the browser.
- You can disable output buffering with the
mod_fastcgi
ormod_fcgi
module, but those mods aren't as popular/widely used with Apache 2.4. - If you have
mod_deflate
enabled and don't setSetEnv no-gzip 1
for the virtualhost/directory/etc. that's streaming data, then gzip will not allow the buffer to flush until the request is complete.
我测试的东西出来,看看如何最好地使用Drupal 8的新功能BigPipe的流请求到客户端,我张贴在的这个问题GitHub的。
I was testing things out to see how to best use Drupal 8's new BigPipe functionality for streaming requests to the client, and I posted some more notes in this GitHub issue.
这篇关于如何使用的Apache2和mod_proxy_fcgi禁用缓冲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!