Skip to content

Configuring Atmosphere for Performance

jfarcand edited this page Apr 18, 2013 · 4 revisions

Use this only with 1.0.12 and lower. With 1.0.12 and higher, it is recommend to not change anything.

Configuring your application to get the best performance of Atmosphere can be a difficult task. Please make sure you understand what is a Broadcaster before reading this document.

The first decision to make when configuring Atmosphere is to associate a Broadcaster with its own Thread Pool (ExecutorService) or use a single one, shared amongst the set of Broadcaster your application will create.

The second decision to make is to answer the following question: is message order important? Stated differently, does the order of invoking

broadcaster.broadcast("...");

is important for your application or not.

By default, the order is guarantee, e.g invoking

broadcaster.broadcast("message-1");
broadcaster.broadcast("message-2");
broadcaster.broadcast("message-3");

will be received by the client as:

message-1
message-2
message-3

If your application doesn't need to enforce messages order, you may want to disable the mechanism as it significantly improve the performance of messages delivery.

First, disable the mechanism by doing

<init-param>
   <param-name>org.atmosphere.cpr.Broadcaster.supportOutOfOrderBroadcast</param-name>
  <param-value>true</param-value>
</init-param>

Next, make sure you change the default Thread Pool that ship with Atmosphere as you may run out of memory, as the Thread pool is unbounded. Just set: To configure the maximum threads created by the Broadcaster of the message delivery, just add

        <init-param>
            <param-name>org.atmosphere.cpr.broadcaster.maxProcessingThreads</param-name>
            <param-value>10</param-value>
        </init-param>

and for the one used for the write operation,

        <init-param>
            <param-name>org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads</param-name>
            <param-value>10</param-value>
        </init-param>

That could significantly improve the performance of your application.

Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics

API

Known WebServer Issues

References

External Documentations

githalytics.com alpha

Clone this wiki locally