Discussion:
[jetty-dev] How can I implement order guaranteed request for each Client IP?
Sean
2018-07-21 05:20:00 UTC
Permalink
Now, I have some problem in using my Jetty + CXF.
That is,
When requests come in from a large number of Client IPs, Jetty distributes
them to Multi Threads.
At this time, the order is reversed when the request message is
retransmitted.

I try to bind the SOAP Requests coming in Jetty + CXF to each Queue by
Client IPAddress and sequentially process the Message in the Queue for each
client IP
(Request order should be guaranteed for each Client IP).
I would appreciate if you could show me how to implement it.



--
Sent from: http://jetty.4.x6.nabble.com/Jetty-Dev-f3247346.html
Greg Wilkins
2018-07-21 07:39:39 UTC
Permalink
Sean,

Even if Jetty did impose an order constraint between different connections
(which it does not), this order would not be guaranteed at the client.
Different connections may be buffer or even routed differently through the
network and packets in one connection may overtake packets in other
connections from the same client.

So what you are trying to do is simply impossible at the network transport
level.

If you want ordering, then you either have to use a single connection or
somehow impose an ordering at the application level.

regards
Post by Sean
Now, I have some problem in using my Jetty + CXF.
That is,
When requests come in from a large number of Client IPs, Jetty distributes
them to Multi Threads.
At this time, the order is reversed when the request message is
retransmitted.
I try to bind the SOAP Requests coming in Jetty + CXF to each Queue by
Client IPAddress and sequentially process the Message in the Queue for each
client IP
(Request order should be guaranteed for each Client IP).
I would appreciate if you could show me how to implement it.
--
Sent from: http://jetty.4.x6.nabble.com/Jetty-Dev-f3247346.html
_______________________________________________
jetty-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev
--
Greg Wilkins <***@webtide.com> CTO http://webtide.com
Sean
2018-07-21 11:12:18 UTC
Permalink
Hi, GregThank 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
<Loading Image...>



--
Sent from: http://jetty.4.x6.nabble.com/Jetty-Dev-f3247346.html
Greg Wilkins
2018-07-21 13:49:43 UTC
Permalink
Sean,

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.

regards
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
<http://jetty.4.x6.nabble.com/file/t361462/MessageProcess.JPG>
------------------------------
Sent from the Jetty Dev mailing list archive
<http://jetty.4.x6.nabble.com/Jetty-Dev-f3247346.html> at Nabble.com.
_______________________________________________
jetty-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev
--
Greg Wilkins <***@webtide.com> CTO http://webtide.com
Sean
2018-07-22 07:15:05 UTC
Permalink
Hi, Greg

I respect your activity.

Your advice helps relieve of many uncertainties about Jetty.
Thank you very much.

Best Regards

Sean



--
Sent from: http://jetty.4.x6.nabble.com/Jetty-Dev-f3247346.html

Loading...