BlackBerry MDS Push request from a push application to the BlackBerry MDS Connection Service
When working with a BlackBerry MDS push request, it is important to understand that the Apache Tomcat™ server acts as a front end to the BlackBerry MDS -CS push layer as part of the BlackBerry MDS Connection Service installation. When making a push request, either PAP or RIM, from a push application, the request is first processed by the Apache Tomcat server.
The Apache Tomcat server has two values, acceptCount and maxThreads, that must be understood when making a BlackBerry MDS push request to avoid receiving a 503 service unavailable response error.
When making BlackBerry MDS Push requests, the maximum permitted number of simultaneous socket connections is 200. This represents the maxThreads, or worker threads, value of the Apache Tomcat server. Once maxThreads reaches 200, further connection requests are queued and limited by the acceptCount value. When acceptCount also reaches 1000, a 503 service unavailable Apache Tomcat error is received by the push application and is displayed in the Apache Tomcat log files.The log files are stored in the following location by default:
C:\Program Files\Research In Motion\BlackBerry Enterprise Server\Logs\webserver
As a best practice, a push application should monitor the maximum number of simultaneous socket connections and queue the pending push requests. For example, when your push application has reached 200 simultaneous socket connections, you should to send a push request only after a thread from the maxThreads thread pool has been released. This makes sure that the pending push requests are queued within your push application and will not overflow the acceptCount.
Note: Any Hypertext Transfer Protocol (HTTP) response received by the push application indicates that a worker thread has been released back to the thread pool. For example, when a push application receives an HTTP 200 response, it indicates that a worker thread was released.
It is important to know that the push layer in BlackBerry MDS-CS is executed by the Apache Tomcat worker thread. If the push request processing rate in the BlackBerry MDS-CS push layer is slower than the incoming push request rate it exceeds the maxThreads and acceptCount limits, and the application receives a 503 service unavailable error. If the push application monitors the number of active connections and only sends a push request only after worker threads are released, you will not receive a 503 service unavailable error.
BlackBerry MDS Push request from BlackBerry MDS-CS push layer to a BlackBerry smartphone
After the push object is passed to the BlackBerry MDS-CS push layer, the worker thread is released to the Apache Tomcat maxThread thread pool and an response is sent to the push application. The Max number of Active Connections field in BlackBerry Manager defines the maximum value of a counter at the BlackBerry MDS-CS push layer. This limits the number of push connections to BlackBerry smartphones connected to the BlackBerry MDS-CS.
For example, one BlackBerry MDS Push request to ten BlackBerry smartphones increases this counter Max number of Active Connections by ten. This Max number of Active Connections value is decreased when the device push connection is completed (either successfully or not successfully).
The Maximum Number of Active Connections value is set to 1000 by default and can be changed from the BlackBerry Manager or BlackBerry Administration Service using the BlackBerry MDS settings.
If the Max Number of Active Connections field reaches the limit, the following error is displayed in the BlackBerry Enterprise Server MDAT log:
<2009-04-15 14:11:18.339 EDT>::<MDS-CS_MDS>:<DEBUG>:<LAYER = SCM, EVENT = Number of active push connections:1000> <2009-04-15 14:11:56.184 DT>::<MDS-CS_MDS>:<DEBUG>:<LAYER = SCM, EVENT = PushServlet: FAILED –Push service is unavailable>
There can be many reasons for BlackBerry MDS Push requests to queue at the BlackBerry MDS-CS push layer. For example, one push request can contain a push request to multiple BlackBerry smartphones and results in multiple push connections created to the BlackBerry smartphones. Another example is BlackBerry smartphones that are out of coverage. By default, the BlackBerry MDS-CS queues pending and new push requests for out of coverage BlackBerry smartphones for 10 minutes unless the BlackBerry smartphones come back into coverage within the 10 minute timeout period.
For additional information on BlackBerry MDS Push flow control search for the knowledge base article Mobile data service push flow control.