什么是Phusion乘客PassengerMaxRequestQueueSize的最佳值 [英] What is optimal value for Phusion passenger PassengerMaxRequestQueueSize

查看:373
本文介绍了什么是Phusion乘客PassengerMaxRequestQueueSize的最佳值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这取决于盒子硬件,但是例如如果设置100个进程,默认队列也是100.是否有意义增加 PassengerMaxRequestQueueSize 更改为200或300?这可能取决于空闲内存。

I know this depends on the box hardware, but for example if there are set 100 processes, the default queue is also 100. Does it makes sense to increase PassengerMaxRequestQueueSize to 200 or 300? Probably this depends on free memory. Thoughts?

最好的答案将解释设置,可能一个或两个例子,假设服务器进程请求2-3秒。

The best answer will be explaining the setting and probably one or two examples, assuming the server process requests for 2-3 seconds.

提前感谢!

推荐答案

为什么应该限制排队



任何不由应用程序进程立即处理的请求都会排队。排队通常是坏的:它通常意味着您的服务器不能足够快地处理请求。

Why you should limit queuing

Any requests that aren't immediately handled by an application process, are queued. Queuing is usually is bad: it often means that your server cannot handle the requests quickly enough.

更大的队列意味着请求不太可能被丢弃。但是这有一个缺点:在忙碌的时候,队列越大,您的访问者必须等待更长的时间才能看到响应。这使得它们单击重新加载,使队列更长(它们先前的请求将保留在队列中;操作系统不知道它们已经断开连接,直到尝试将数据发送回访问者),或者使他们离开沮丧。

A larger queue means that requests are less likely to be dropped. But this comes with a drawback: during busy times, the larger the queue, the longer your visitors have to wait before they see a response. This causes them to click reload, making the queue even longer (their previous request will stay in the queue; the OS does not know that they've disconnected until it tries to send data back to the visitor), or causes them to leave in frustration.

所以在队列上有一个限制是件好事。它限制了上述情况的影响。

So having a limit on the queue is a good thing. It limits the impact of the above situation.

您应该确保请求尽可能少排队。这可能意味着:

You should ensure that requests are queued as little as possible. That could mean:


  • 使您的应用程序更快(如果您的工作负载受CPU限制)。


  • 增加应用程序的并发设置(如果您的工作负载受I / O限制),例如,

如果您无法阻止请求排队,那么最好的做法是保持队列,并在达到队列限制时显示友好的错误消息。有些事情,很抱歉,很多人现在正在访问我们,请稍后再试。 PassengerMaxRequestQueueSize的文档告诉您如何操作。

If you cannot prevent requests from being queued, then the next best thing to do is to keep the queue short, and to display a friendly error message upon reaching the queue limit. Something like, "We're sorry, a lot of people are visiting us right now. Please try again later." The documentation for PassengerMaxRequestQueueSize tells you how to do that.

很难说最优的队列大小应该是多少。一个好的经验法则是:将请求队列大小设置为您在一秒钟内可以处理的最大请求数。根据您的情况,您可能需要稍微调整一些东西。

It's hard to say what the optimal queue size should be. A good rule of thumb is: set the request queue size to the maximum number of requests you can handle in one second. Depending on your situation you may have to tweak things a little bit.

这条经验法则源于预期突发流量的概念。您希望在您的服务器上同时发出多少个请求?

This rule of thumb comes from the notion of expected burst traffic. How many simultaneous requests do you expect on your server?

假设您的队列大小为100,而且无论何种原因,您同时收到150个请求。假设您的服务器速度足够快,可在半秒内处理150个请求,因此您知道这不是性能问题。但是,如果您的请求队列大小为100,那么其中50个请求将被丢弃,并显示请求队列已满错误。

Suppose that your queue size is 100, and that for whatever reason you receive 150 requests at the same time. Suppose that your server is fast enough to handle 150 requests in half a second, so you know it's not a performance problem. But if you have a request queue size of 100, then 50 of those requests will be dropped with a "Request queue full" error.

在这种情况下,将队列大小设置为您认为可以安全处理而不会出现性能问题的并发请求的最大数量。

In such a situation, you should set the queue size to the maximum number of concurrent requests that you think you can safely handle without performance issues.

这篇关于什么是Phusion乘客PassengerMaxRequestQueueSize的最佳值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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