Apache:ProxyPass max 参数无效
我正在使用以下 Apache 配置将请求转发到 Tomcat 服务器:
ProxyPass /myapp ajp://localhost:8009/myapp max=2
这是一个简化的配置,但足以重现该问题,即 max 参数不起作用。如果我向 Apache 发送 10 个并发请求,所有 10 个请求都会同时转发到 Tomcat,而我希望将它们 2 个 2 个转发。我是否应该使用 max 参数以外的其他参数?
I am using the following Apache config to forward requests to a Tomcat server:
ProxyPass /myapp ajp://localhost:8009/myapp max=2
This is a simplified config, but is enough to reproduce the issue, which is that the max parameter has no effect. If I through 10 concurrent requests to Apache, all 10 are forwarded to Tomcat at the same time, while I would like to have them forwarded 2 by 2. Should I use something other than the max parameter for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
max=2
无法限制并发转发到 Tomcat 的请求数量,因为我在 UNIX 上运行它,并且我的 Apache 预先配置了 prefork MPM,它为每个请求创建一个进程。max
适用于每个进程,因此没有达到预期的效果。如果您遇到这种情况并且需要限制转发到 Tomcat 的并发请求数,那么您需要将 Apache 替换为工作器或事件 MPM Apache,在配置中将
ServerLimit
设置为 1,将ThreadsPerChild
和MaxClients
设置为相同的值,这将是您的 Apache 能够处理的并发连接总数。您可以在本节中找到更多信息,记录 Orbeon Forms 的推荐 Apache 配置。The
max=2
failed to limit the number of requests concurrently forwarded to Tomcat because I was running this on UNIX, and my Apache came preconfigured with prefork MPM, which creates one process per request. Themax
applies per process, hence doesn't have the desired effect.If you are in this situation and need to limit the number concurrent request forwarded to Tomcat, then you'll need to replace your Apache with a worker or event MPM Apache, in the config set
ServerLimit
to 1, andThreadsPerChild
andMaxClients
to the same value, which will be the total number of concurrent connections your Apache will be able to process. You can find more information about this in this section documenting the recommended Apache configuration for Orbeon Forms.