限制对 servlet 的请求数 [英] Limiting number of requests to a servlet

查看:39
本文介绍了限制对 servlet 的请求数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 servlet,由于它的逻辑,它在服务器上占用更多的虚拟内存.出于这个原因,我们希望限制对这个服务器的并发请求,例如我们只希望处理 10 个并发请求.其他请求必须在队列中等待.

We have a servlet which occupies more virtual memory on the server due to the logic it has. For this reason, we would like to limit the concurrent requests to this server say for example we would only want 10 concurrent requests processed. The other requests have to wait in the queue.

可以为这个 servlet 创建和分配一个自定义线程池来处理这种情况吗?我们使用的是 WebLogic 服务器 9.2.或者有没有其他更好的方法来做到这一点?欣赏任何想法.

Can a custom thread pool be created and assign for this servlet to handle this scenario? We are using WebLogic server 9.2. Or is there any other better approach to do this? Appreciate any thoughts.

推荐答案

可以为这个 servlet 创建和分配一个自定义线程池来处理这种情况吗?我们使用的是 WebLogic 服务器 9.2.或者有没有其他更好的方法来做到这一点?欣赏任何想法.

Can a custom thread pool be created and assign for this servlet to handle this scenario? We are using WebLogic server 9.2. Or is there any other better approach to do this? Appreciate any thoughts.

是的,这是可能的.而不是使用 默认的自调整工作管理器(从 Weblogic 9.x 开始,线程池的工作管理器替换了执行队列1),您可以创建具有特定 约束,例如max-threads-constraint 和可能是容量.然后,您可以使用 wl-dispatch-policy.

Yes, this is possible. Instead of using the default self-tuning work manager (starting with Weblogic 9.x, execute queues are replaced by work managers for thread pools1), you could create a work manager with specific constraints like the max-threads-constraint and possibly the capacity. You can then assign a Servlet to a specific work manager using the wl-dispatch-policy of the weblogic.xml deployment descriptor file.

1 请注意,仍然可以启用 WebLogic 8.1 线程池模型并使用执行队列.

1 Note that it's still possible to enable WebLogic 8.1 Thread Pool Model and to use Execute Queues.

这篇关于限制对 servlet 的请求数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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