Jetty has moved!
Jetty is a project at the Eclipse Foundation.
Homepage:http://www.eclipse.org/jetty
Downloads: http://download.eclipse.org/jetty/
Documentation:http://www.eclipse.org/jetty/documentation/current/
About:http://www.eclipse.org/jetty/about.php
Jetty Powered:http://www.eclipse.org/jetty/powered/
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Quality of Server Filter

The blocking nature of the standard servlet API makes it impossible to implement web applications that can guarantee some level of Quality of Service (QoS). Threads and memory are limited resources within a servlet container, yet with the standard servlet API, the only way to handle a HTTP request is with a thread allocated for the entire duration of the request. If a request is of low priority, or if other resources needed by the request are not available, then it is not possible to reuse the thread allocated to the request for high priority requests or requests that can proceed.

Jetty susports Suspendable Requests, which allows non-blocking handling of HTTP requests, so that that threads may be allocated in a managed way to provide application specific QoS. The QoSFilter is utility servlet filter that uses suspendable requests to implement some QoS features.

Examples of the Problem

Slow Resource

Bursty Traffic

Thread Pool limit

QoSFilter

Sample XML configuration (to be placed in a webapp's web.xml or jetty-web.xml)

This configuration will process only five requests at a time, servicing more important requests first, and queuing up the rest:

Mapping to URLs

You can use then use the <filter-mapping> syntax to map the QoSFilter to a servlet, either by using the servlet name, or by using a URL pattern. In this example, the QoSFilter is applied to every request within the web application context:

The full list of initParameters

  • maxRequests - the maximum number of requests to be serviced at a time.
  • maxPriority - the maximum valid priority that can be assigned to a request. A request with a high priority value is more important than a request with a low priority value.
  • waitMS - length of time, in milliseconds, to wait while trying to accept a new request. Used when the maxRequests limit is reached.
  • suspendMS - length of time, in milliseconds, that the request will be suspended if it is not accepted immediately. If not set, the container's default suspend period will be used.
  • No labels
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery