Frequently Asked Questions
Sequentially sent oneway requests cannot arrive out of order, but the server may dispatch them out of order.
Assuming that oneway requests are not sent in parallel by multiple threads, and that all oneway requests use the same connection to the server (which is usually the case, unless different protocols or timeouts are used), then the client-side Ice runtime ensures that the protocol messages for these requests are sent in order.
However, if the server employs a thread pool, then the server-side Ice runtime will dispatch oneway requests in parallel, up to the maximum number of threads that is configured for the thread pool. It is therefore possible for oneway requests to be dispatched in an order that differs from the order in which they were received, depending on how the operating system schedules threads.
Out-of-order dispatch cannot happen with twoway invocations. For sequentially-sent twoway invocations, the client always waits until it has received a response from the server for an outstanding twoway before it sends another twoway. Since the server only sends a response once it has completed dispatching of the twoway call (or at least started dispatching, if the server uses asynchronous message dispatching), twoways cannot be dispatched out of order.
There are three ways to avoid out-of-order dispatching of oneway requests. The first way is to simply configure only one thread for the server-side thread pool. With only one thread, no requests can be dispatched in parallel. The second option is to use the thread-per-connection concurrency model. In this case, each connection has a single, dedicated thread, so requests that arrive over the same connection cannot be dispatched in parallel. Finally, you can use batched oneways. All oneway requests from a single batch are guaranteed to be dispatched in order by the same server thread, regardless of the number of threads in the thread pool.