简体   繁体   English

红宝石在Apache上不能保持连接存活

[英]ruby on apache not keeping connection alive

I have a ruby on rails app serving an API. 我在提供API的Rails应用程序上有一个Ruby。 It's legacy and we've already built a replacement on a more suitable stack, so no such suggestions in that direction needed :) 这是旧的,我们已经在更合适的堆栈上构建了替代产品,因此在该方向上不需要此类建议:)

But we need to improve the performance on it regarding latency of response. 但是我们需要在响应延迟方面提高其性能。 I noticed keepalive was off. 我注意到Keepalive已关闭。 So I enabled it in apache. 所以我在apache中启用了它。 Now the static files from that server are responding with connection: keep-alive in the response headers. 现在,来自该服务器的静态文件通过连接进行响应:响应头中的keep-alive。 But the api (dynamic, rudy generated xml) still responds with connection: close. 但是api(动态,红润生成的xml)仍然会通过以下连接做出响应:关闭。 Sure enough it appears to be closing the connection on the client. 果然它似乎正在关闭客户端上的连接。 Passenger is the Apache module used. 乘客是使用的Apache模块。

How can I make it use keepalive for the ruby generated responses? 如何使它对红宝石生成的响应使用keepalive?

Thanks 谢谢

I can not reproduce this. 我无法重现。 I just tried, with Apache 2.2.3, passenger 3.0.12 我刚刚尝试使用Apache 2.2.3,乘客3.0.12

The responses from my rails app do not have connection:close, they are kept alive. 我的rails应用程序的响应没有连接:关闭,它们保持活动状态。 (They in fact have a Connection: Keep-Alive too, although I don't think HTTP 1.1 requires that. (实际上,他们也有一个Connection: Keep-Alive ,尽管我不认为HTTP 1.1要求这样做。

So long as my apache has KeepAlive On . 只要我的Apache的KeepAlive On

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM