About Configuring a Multithreaded Standalone Server or Listener
To configure a multithreaded standalone server, you need to add properties to the transport configuration file
transports.xml. To configure a multithreaded standalone listener in the event that you are using the message pattern notification, add properties instead to the client-side transport configuration file,
client-transports.xml. See
Table 17 for details on these properties.
Table 17 – Multithreaded standalone server and listener properties
Property name | Value | Description |
---|
accepter-threads | int | Specifies the number of threads that should be spawned listening for new connections. Defaults to 1. |
thread-pool-min | int | The minimum number of threads to be created in the thread pool. Defaults to 0. |
thread-pool-max | int | The maximum number of threads to be created in the thread pool. Defaults to 0.1 |
To implement a multithreaded standalone server, you must specify a non-default value for the accepter-thread property or for the thread pool properties; otherwise, only one thread is created to accept incoming requests.
To ensure that incoming connections are handled correctly, we recommend that you do set values for the two thread pool properties in order to implement a thread pool. In this way, the accepter threads accept the connection, pass it off to the thread pool, and then go back to accepting connections. The thread pool then queues the request, ensuring that any client trying to connect will actually get through.
Without a thread pool, the accepter threads do the actual work, potentially “starving” incoming connections if no threads are available. Most importantly, using accepter threads without a thread pool can result in a Denial of Service attack if incoming messages open connections to all of your accepter threads, and then send small requests that keep them open indefinitely.
To configure your multithreaded server, add the following lines to the listener you will use in transports.xml, or in client-transports.xml if you are using the message pattern notification:
<rwsf:listener name="HTTP"
...
<rwsf:property name="host" value="localhost"/>
<rwsf:property name="port" value="9090"/> -->
<rwsf:property name="accepter-threads" value="2"/>
<rwsf:property name="thread-pool-min" value="5"/>
<rwsf:property name="thread-pool-max" value="20"/>
...
</rwsf:listener>