Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] How can I implement order guaranteed request for each Client IP?


there is no single queue that maintains order of arrival of requests in Jetty.  Different requests will arrive on different connections, which may be handled by different selectors which run entirely independently of each other. Even if they are on a single selector, the order they are selected is entirely dependent in the implementation of the Set iterator, which has no guarantee about the order.

The design of jetty is specifically done so as to avoid synchronisation points that can become congested.  Jetty doesn't distribute requests to Random threads. The requests start off already distributed among random threads which do the  selection, IO and parsing.   There is no queue of requests, no centralised point of contention to base an ordering on.   There is no way of telling if one request was received before or after another.  This is deliberately by design and required so that jetty can scale.

We do set a timestamp on each request, but only to millisecond accuracy, so you can have several requests arriving at the same time, but even with nanosecond accuracy that would still be possible on a multi-core machine for 2 CPUs to receive requests from the same client at precisely the same time.  If you want an ordering, then you will need to create a data structure based on client IP that your application can synchronise on soon after receiving the request.


On 21 July 2018 at 13:12, Sean <ebirdkim@xxxxxxxxx> wrote:
Hi, Greg Thank you for your kind response. I already knew that the order is not guaranteed at the network transport level. I'm using Jetty + CXF as a "server", and I'm not interested in the order that the client sends. I just want the requests sent by multiple clients to put in the queues assigned to each IP at Jetty server. In order to do this, Jetty distributes the messages to the queue before they are assigned to them by Random Thread. I am looking for a way to stack up in the queue by IP within Jetty for this task. Apart from the client, I want to know the functions and settings that can manage the distributed queue by the request IP in the Jetty Server. Thank you. MessageProcess.JPG

Sent from the Jetty Dev mailing list archive at

jetty-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit


Back to the top