-
-
Notifications
You must be signed in to change notification settings - Fork 751
Configuring Atmosphere for Performance
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.
- Understanding Atmosphere
- Understanding @ManagedService
- Using javax.inject.Inject and javax.inject.PostConstruct annotation
- Understanding Atmosphere's Annotation
- Understanding AtmosphereResource
- Understanding AtmosphereHandler
- Understanding WebSocketHandler
- Understanding Broadcaster
- Understanding BroadcasterCache
- Understanding Meteor
- Understanding BroadcastFilter
- Understanding Atmosphere's Events Listeners
- Understanding AtmosphereInterceptor
- Configuring Atmosphere for Performance
- Understanding JavaScript functions
- Understanding AtmosphereResourceSession
- Improving Performance by using the PoolableBroadcasterFactory
- Using Atmosphere Jersey API
- Using Meteor API
- Using AtmosphereHandler API
- Using Socket.IO
- Using GWT
- Writing HTML5 Server-Sent Events
- Using STOMP protocol
- Streaming WebSocket messages
- Configuring Atmosphere's Classes Creation and Injection
- Using AtmosphereInterceptor to customize Atmosphere Framework
- Writing WebSocket sub protocol
- Configuring Atmosphere for the Cloud
- Injecting Atmosphere's Components in Jersey
- Sharing connection between Browser's windows and tabs
- Understanding AtmosphereResourceSession
- Manage installed services
- Server Side: javadoc API
- Server Side: atmosphere.xml and web.xml configuration
- Client Side: atmosphere.js API