+

Search Tips   |   Advanced Search

Asynchronous request dispatcher

Asynchronous request dispatcher (ARD) can improve Servlet response time when slow operations can be logically separated and performed concurrently with other operations required to complete the response. ARD enables Java servlet programmers to perform standard javax.servlet.RequestDispatcher include calls for the same request concurrently on separate threads. These javax.servlet.RequestDispatcher include calls are completed sequentially on the same thread. ARD is also useful in low CPU, long wait situations like waiting for a database connection.

If there are large CPU or memory requirements, ARD alone does not alleviate those issues. However, in combination with the remote request dispatcher, operations driven by one servlet request that can be performed concurrently on multiple application servers, alleviating resource demand on a single server and decreasing the risk of a system down situation.

Servlets, portlets, and JSP files can all utilize ARD. This functionality is an extension beyond the requirements of the Java Servlet Specification, which only describes synchronous request dispatching. ARD requires a new channel, called the ARD channel, between the HTTP and web container channels to form a new channel chain. These new chains correspond only to the existing default host chains and reuse the same ports.

Each include can write output to the client and because ordering is important for valid results, there must be some aggregation of the data written. Typically, a servlet writes data to a buffer and once full, it is flushed to client. For server-side aggregation, the ARD channel cannot flush until any includes that had placeholders written to the current buffer are finished.

Client-side aggregation of the asynchronous include is also supported. Web 2.0 programmers often use Asynchronous JavaScript and XML (Ajax) in the Web browser of the client to dynamically retrieve and aggregate remote resources. Unfortunately, this puts the burden on the programmer to aggregate the contents and learn new technologies. Client-side aggregation automatically adds the necessary JavaScript to dynamically update the page. For non-JavaScript clients, we can switch ARD to server-side aggregation, which gives equivalent results. We can deny non-JavaScript clients when using client-side aggregation.

ARD uses the web container APIs to plug in unique request dispatching logic. It interacts with WCCM to read in configuration information for enablement status per enterprise application as well as a global appserver setting. Use the administrative console and wsadmin to enable or disable ARD. Servlets, portlets, and JSP files can all utilize ARD.


Subtopics

  • Developing servlet applications using asynchronous request dispatcher
  • Asynchronous request dispatcher application design considerations