Apache mod_proxy 和 Tomcat 的 Bad Gateway 502 错误 [英] Bad Gateway 502 error with Apache mod_proxy and Tomcat

查看:50
本文介绍了Apache mod_proxy 和 Tomcat 的 Bad Gateway 502 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在 Tomcat 6 和 Apache mod_proxy 2.2.3 上运行一个网络应用程序.看到很多这样的502错误:

We're running a web app on Tomcat 6 and Apache mod_proxy 2.2.3. Seeing a lot of 502 errors like this:

坏网关!代理服务器收到来自上游服务器的无效响应.

Bad Gateway! The proxy server received an invalid response from an upstream server.

代理服务器无法处理请求 GET/the/page.do.

The proxy server could not handle the request GET /the/page.do.

原因:从远程服务器读取错误

Reason: Error reading from remote server

如果您认为这是服务器错误,请联系网站管理员.

If you think this is a server error, please contact the webmaster.

错误 502

Tomcat 有很多线程,所以它不受线程限制.我们正在通过 JMeter 向应用推送 2400 名用户.所有的盒子都位于我们的防火墙内,位于一个快速卸载的网络上,所以不应该有任何网络问题.

Tomcat has plenty of threads, so it's not thread-constrained. We're pushing 2400 users via JMeter against the app. All the boxes are sitting inside our firewall on a fast unloaded network, so there shouldn't be any network problems.

有人有什么建议可以看看或尝试吗?接下来我们将前往 tcpdump.

Anyone have any suggestions for things to look at or try? We're heading to tcpdump next.

更新 10/21/08:仍然没有弄清楚这一点.在负载下只看到非常少的这些.下面的答案还没有提供任何神奇的答案……还没有.:)

UPDATE 10/21/08: Still haven't figured this out. Seeing only a very small number of these under load. The answers below haven't provided any magical answers...yet. :)

推荐答案

所以,在这里回答我自己的问题.我们最终确定,由于 Tomcat 线程超时,我们在负载平衡器中看到了 502 和 503 错误.在短期内,我们增加了超时时间.从长远来看,我们首先修复了导致超时的应用程序问题.为什么 Tomcat 超时在负载均衡器上被视为 502 和 503 错误仍然有点神秘.

So, answering my own question here. We ultimately determined that we were seeing 502 and 503 errors in the load balancer due to Tomcat threads timing out. In the short term we increased the timeout. In the longer term, we fixed the app problems that were causing the timeouts in the first place. Why Tomcat timeouts were being perceived as 502 and 503 errors at the load balancer is still a bit of a mystery.

这篇关于Apache mod_proxy 和 Tomcat 的 Bad Gateway 502 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆