Can Aeron UDP totally replace TCP for communication?

1,869 views
Skip to first unread message

Gazit Gu

unread,
Jun 29, 2016, 12:18:31 AM6/29/16
to mechanical-sympathy
Hi Martin,

Thanks for all your team's contribution to Aeron/SBE, we are consider using Aeron as one of out trading system transport (transport layer is transparent to the real logic), and we have tested the performance of ping-pong and publish-subscribe rate, ping-pong RTT time 99.99% less than 8us (50%<3us) (over boxes is about 30us 99.6%), and throughput for IPC/UDP (localhost) is about 17~23 million messages/second, message size is 256byte, this is totally expected as Aeron described.

Above result is based on changed nothing on os level parameter (i am sure if follow the wiki recommend os setting can have better performance )

What we want to confirm is can UDP totally replace TCP on the message exchange between different boxs, for tcp, you only need server ip and port and then can do request/response (no matter how many clients), but from the aeron sample, the pong message was pointed to another port, what if i have two clients talk to aeron udp (then do i need to unicast to each client with their own ip/port)?can i just directly send response message through request udp connection? 

Thanks for you time.

-Gazit

Todd Montgomery

unread,
Jun 29, 2016, 1:53:26 AM6/29/16
to mechanical-sympathy
Hello. Thanks!

Aeron is uni-directional within a single stream. A Publication sends to Subscriptions. There is no response channel built in. But composing a response channel into an application can be done as easy as using another stream in the opposite direction. Most of the time, it is simply connecting the applications together and sending responses in the correct direction.

-- Todd 

--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gazit Gu

unread,
Jun 29, 2016, 2:22:57 AM6/29/16
to mechanical-sympathy
Thanks for your quick response Todd.

Is that means i can use say streamId 10 as the inbound stream and 11 as the outbound stream with the same channel? in this way the publish and subscribe share the same channel but with different stream, am i right?

Thanks again.

-Gazit

Gazit Gu

unread,
Jun 29, 2016, 2:44:59 AM6/29/16
to mechanical-sympathy
to confirm the way, i did below test (both udp and ipc works fine):

java -cp samples.jar \
    -XX:+UnlockDiagnosticVMOptions \
    -XX:GuaranteedSafepointInterval=300000 \
    -XX:BiasedLockingStartupDelay=0 \
    -Dagrona.disable.bounds.checks=true \
    io.aeron.samples.LowLatencyMediaDriver
--With UDP
java -cp samples.jar \
    -XX:+UnlockDiagnosticVMOptions \
    -XX:GuaranteedSafepointInterval=300000 \
    -Dagrona.disable.bounds.checks=true \
-Daeron.sample.ping.streamId=10 \
-Daeron.sample.pong.streamId=11 \
-Daeron.sample.ping.channel=aeron:udp?endpoint=localhost:40123 \
-Daeron.sample.pong.channel=aeron:udp?endpoint=localhost:40123 \
    io.aeron.samples.Pong
java -cp samples.jar \
    -XX:+UnlockDiagnosticVMOptions \
    -XX:GuaranteedSafepointInterval=300000 \
    -Daeron.sample.messages=100000 \
    -Daeron.sample.messageLength=100 \
    -Dagrona.disable.bounds.checks=true \
-Daeron.sample.ping.streamId=10 \
-Daeron.sample.pong.streamId=11 \
-Daeron.sample.ping.channel=aeron:udp?endpoint=localhost:40123 \
-Daeron.sample.pong.channel=aeron:udp?endpoint=localhost:40123 \
    io.aeron.samples.Ping
--With IPC
java -cp samples.jar \
    -XX:+UnlockDiagnosticVMOptions \
    -XX:GuaranteedSafepointInterval=300000 \
    -Dagrona.disable.bounds.checks=true \
-Daeron.sample.ping.streamId=10 \
-Daeron.sample.pong.streamId=11 \
-Daeron.sample.ping.channel=aeron:ipc \
-Daeron.sample.pong.channel=aeron:ipc \
    io.aeron.samples.Pong
java -cp samples.jar \
    -XX:+UnlockDiagnosticVMOptions \
    -XX:GuaranteedSafepointInterval=300000 \
    -Daeron.sample.messages=100000 \
    -Daeron.sample.messageLength=100 \
    -Dagrona.disable.bounds.checks=true \
-Daeron.sample.ping.streamId=10 \
-Daeron.sample.pong.streamId=11 \
-Daeron.sample.ping.channel=aeron:ipc \
-Daeron.sample.pong.channel=aeron:ipc \
    io.aeron.samples.Ping

and the IPC latency max 25us while 99.84%<5us (without any os parameter trunig).

but when i run two ping process with one pong using udp, seems two ping processes cannot distinguish each other,  any advise on this?(something like more client want their own response)

Thanks again.

-Gazit

Martin Thompson

unread,
Jun 29, 2016, 7:14:24 AM6/29/16
to mechanical-sympathy
You need to be thinking in terms of endpoints for the channels. The endpoint is a UDP unicast socket or a multicast group. If unicast then you need to look at the source identity and respond if you do not already know the topology. For multicast you can have conventions on addresses and ports.

Your example is failing because you are using the same channel for both directions. You need one channel for each direction and optionally have multiple streams go down each channel. Try something like:

-Daeron.sample.ping.channel=aeron:udp?endpoint=localhost:40123 \
-Daeron.sample.pong.channel=aeron:udp?endpoint=localhost:40124 \

Note the ports are different to give a different endpoint to which the each channel is going.

IPC works because it is all the same SHM endpoint.

Gazit Gu

unread,
Jun 29, 2016, 10:10:00 PM6/29/16
to mechanical-sympathy
Thanks Martin,

I can make the single ping pong work even on different server, but with two ping and one pong doesn't works, say pong on serverA and ping on ServerB and ServerC, how can the pong send back the message to its ping endpoint correctly? i mean how can ServerB and ServerC can get their own pong message without disrupt messages.

Do i have to keep the host name and port where ping comes from and then construct the response channel, in this way i believe i can works, while TCP protocol don't need this since it has response channel build in.

Just want to make the request/response work with recommend way, Thanks.

-Gazit

Martin Thompson

unread,
Jun 30, 2016, 3:00:36 AM6/30/16
to mechanica...@googlegroups.com
It is probably better to ask Aeron usage questions which are unrelated to mechanical sympathy in the Gitter chat room.



--
Reply all
Reply to author
Forward
0 new messages