# Async Example

These examples illustrate Struts build in support for async request processing.

When you have a process that takes a long time, it can make your app not scalable under heavy load conditions. Scalability limitations include running out of memory or exhausting the pool of container threads. To create scalable web applications, you must ensure that no threads associated with a request are sitting idle, so the container can use them to process new requests. Asynchronous processing refers to assigning these blocking operations to a new thread and returning the thread associated with the request immediately to the container.
Reference: Asynchronous Processing
An interesting and vital use case for the async request processing is server push. A good solution is to use the Servlet 3.0+ asynchronous feature.

## Example: A minimal chat room using server push

### Open current page in different tabs, browsers and computers then send messages.

#### This is a minimal chat room which uses server push to retrieve new messages. It doesn't poll the server frequently to check if a new message is available to display. Instead it waits for the server to push back new messages. This approach has two obvious advantages: low-lag communication without requests being sent, and no waste of server resources and network bandwidth.

##### Reference: Asynchronous processing support in Servlet 3.0