Queue and topic settings  Shared listeners

Chapter 8: Message Service Tuning

Thread pools

Using a thread pool can significantly improve performance. For applications that use the JMS API, create thread pools in EAServer Manager as described in “Thread pools” in the EAServer System Administration Guide. If using jagtool, create and configure thread pools with the jmscreate and jmsset_props commands, respectively. In applications that call the EAServer CtsComponents::MessageService API, you can create thread pools programmatically. For details, see “Creating thread pools programmatically” in the EAServer Programmer’s Guide.

For EJB MDB components and other components that you install as message listeners, EAServer by default delivers messages using a single worker thread (the default thread pool is <system> and cannot be modified). The default configuration guarantees first-in-first-out (FIFO) processing of messages in the queue, based on message priority: EAServer delivers messages serially to one component instance. If you do not require FIFO message ordering, use a customized thread pool to increase throughput. When you use a thread pool with multiple worker threads, EAServer creates multiple component instances that run in different worker threads to process messages concurrently.

When a thread pool is used for client notification, the message queue object is implemented with a specialized server IIOP handler that uses only a few waiting threads to handle blocking receive calls, so it avoids waking large numbers of threads for client notification.

StepsAssigning a thread pool to an MDB

Assigning a thread pool to an MDB component allows EAServer to create multiple instances for concurrent message processing on different threads. Create and assign the thread pool as follows:

  1. Create a thread pool for component notification, and set the workers property to a value greater than 1.

  2. Assign this thread pool to the MDB:

    1. In EAServer Manager, highlight the MDB, and select File | Properties.

    2. On the MDB Type tab, append the name of the thread pool you just created to the Listener name. For example, if you created a thread pool called “threads1” and the Listener Name is MyPkg/MyComp, change the Listener Name to MyPkg/MyComp[threadsl].

    See Chapter 31, “Using the Message Service,” in the EAServer Programmer’s Guide for more information about configuring MDBs.

StepsAssigning a thread pool to a message listener using non-EJB components

EAServer allows you to create non-EJB components that act as message listeners, as described in “Listeners” in the EAServer System Administration Guide. Use a thread pool to allow concurrent message processing by multiple instances of the component. To create and assign the thread pool:

  1. Verify that the component supports concurrent execution. For more information, see “Concurrency”.

  2. Create a thread pool for component notification, and set the workers property to a value greater than 1.

  3. In the message queue where you installed the component as a listener, specify the thread pool name in brackets after the component name, using the format:

    package_name/component_name[threadpool_name]
    

StepsUsing a thread pool for client notifications

Using thread pools to improve performance is generally suitable only for high-volume client notification with transient messages. When message delivery is transactional or IIOP/SSL via the QOP property, the thread pool’s reader and writer threads are not used. To create client applications that use the thread pool:

  1. Create a thread pool. For initial testing, set the value of readers to “3”, writers to “2”, and workers to “0”. Later, based on your own performance measurements, you can increase the number of reader and writer threads if the change improves throughput.

  2. Create a connection factory or modify the one you already use, and set the THREAD_POOL property to the name of the thread pool.

  3. In your client code, use this connection factory to create the topics or queues that you use to create and receive messages.





Copyright © 2005. Sybase Inc. All rights reserved. Shared listeners