如何在 Restlet 中使用 Jetty ThrottlingFilter
我想配置一个 Web 服务,以便一旦接受队列已满,服务就会返回 503。目前,这些请求似乎只是超时。
我确实设置了诸如 maxThreads 和 acceptQueuesize 之类的参数(如下所述:http://www.restlet.org/documentation/1.1/ext/com/noelios/restlet/ext/jetty/JettyServerHelper)。
但是一旦acceptQueue已满,服务就不会响应503。
看来jetty的ThrottingFilter(< a href="http://www.mortbay.org/jetty/jetty-6/apidocs/index.html?index-all.html" rel="nofollow noreferrer">http://www.mortbay.org/jetty /jetty-6/apidocs/index.html?index-all.html) 是我正在寻找的内容,但我不知道如何在我的 Restlet 服务中应用。
I would like to configure a webservice so that once the accept queue is full the service returns 503. Currently, these requests seem to just time out.
I did set paramters like maxThreads and acceptQueuesize (as described here: http://www.restlet.org/documentation/1.1/ext/com/noelios/restlet/ext/jetty/JettyServerHelper).
But the service does not respond with 503 once the acceptQueue is full.
It seems jetty's ThrottlingFilter (http://www.mortbay.org/jetty/jetty-6/apidocs/index.html?index-all.html) is what I'm looking for, but I don't know how to apply within my restlet service.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非您将应用程序作为 WAR 文件部署到 Jetty 中,否则您将无法利用 ThrottlingFilter。 JettyServerHelper 将 Restlet 引导为独立服务器,使用 Jetty 接受 HTTP 连接,因此无法使用 Servlet Filter。 我不确定是否可以在 Servlet 世界之外利用 Jetty 中的 ThrottlingFilter 的类似处理逻辑。
You won't be able to take advantage of ThrottlingFilter unless you deploy your application as a WAR file into Jetty. JettyServerHelper bootstraps Restlet as a standalone server using Jetty to accept HTTP connections and hence cannot utilize a Servlet Filter. I'm not sure if there is anyway to utilize similar processing logic from the ThrottlingFilter in Jetty outside of the Servlet world or not.