Nginx 和 unicorn 故障 - 上游超时

发布于 2024-12-12 08:39:08 字数 378 浏览 1 评论 0原文

我有带有 nginx 和 unicorns 的 Rails 机器。非常典型的设置,您可以在这里查看: https://gist.github.com/7e0f9d762cf4d521d3c4

它有效很好,直到今天,我有很多:

读取响应时上游超时(110:连接超时) 来自上游的标头,客户端:xxx.xxx.xxx.xxx,服务器

在 nginx 的 error.log 中

,重启后就可以了,但我担心它会再次发生。 有谁遇到过类似的问题,或者可以告诉我为什么会发生吗?

I've got rails machine with nginx and unicorns. Quite typical setup, which you can check here: https://gist.github.com/7e0f9d762cf4d521d3c4

It worked quite well, till today, when I've got lots of:

upstream timed out (110: Connection timed out) while reading response
header from upstream, client: xxx.xxx.xxx.xxx, server

in nginx's error.log

After restart it was okay, but I'm afraid that it can happen again.
Does anyone had similar problem, or can tell me why it happened?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

画骨成沙 2024-12-19 08:39:08

我听说过 Monit 和 God 中的实现会检查挂起的套接字。我建议您寻找线程上响应时间增加的情况,这将表明这种情况,当发生这种情况时,让 monit 挂起它,导致独角兽产生一个新的工作线程。

http ://www.stopdropandrew.com/2010/06/01/where-unicorns-go-to-die-watching-unicorn-workers-with-monit.html

另一种可能性是使用thin,这对于非LAN(即WAN 或WWW)设置来说要好一些,因为它不是像Unicorn 那样的快速客户端。

I've heard of implementations in Monit and God that will check for hanging sockets. I would suggest that you look for response times increasing on threads, which will signify this condition, and when it happens, have monit hang it up, causing unicorn to spawn a new worker.

http://www.stopdropandrew.com/2010/06/01/where-unicorns-go-to-die-watching-unicorn-workers-with-monit.html

Another possibility is to use thin, which is a little better for non-LAN (i.e. WAN or WWW) setups because it isn't a fast-client, like Unicorn.

谎言月老 2024-12-19 08:39:08

我也有同样的问题。您可以在 unicorn 错误日志文件和 production.log 文件中找到更多信息。然后你就可以找到真正的问题是什么。也许这是因为您正在处理的文件太大,并且对于 unicorn.rb 有一个超时设置,这会出现这个超时问题。

I have had the same issue. And you can find more info in unicorn error log file and your production.log file. Then you can find what is the real problem. Maybe that is because the file you are processing is too big and for unicorn.rb there is a timeout setting which will arise this time out problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文