0

I am testing multicast of Aeron vs raw TCP server - client.

Aeron model setup:

  • MD processes on each node
  • Starting 1 Publication and 1 Subscriber

Raw Tcp server client:

  • Server: 1 Thread to push 1 million integer messages
  • Client: 1 Thread consuming

Result: Aeron UDP: Taking around 17 seconds Raw TCP: Taking around 8 seconds

As I understand UDP multicast way should be faster than TCP, am I missing anything or misunderstood ? What I should check or fined-tune to make Aeron faster enter image description here

TCP Server

        serverSocket = new ServerSocket(port);

        while(true) {
            Socket clientSocket = serverSocket.accept();
            Thread t = new Thread(){
                @Override
                public void run() {
                    try{
                        System.out.println("Starting new thread serving client");
                        out = new DataOutputStream(clientSocket.getOutputStream());
                        in = new DataInputStream(new BufferedInputStream(clientSocket.getInputStream()));
                        for (int i = 0; i < 1_000_000; i++) {
                            System.out.println("Server sending..." + i + "..!");
                            out.writeInt(i);
                        }
                    } catch (IOException e){
                        //
                    }
                }
            };
            t.start();

        }

TCP client

        System.out.println("I'm client!");
        TcpClient client = new TcpClient();
        String serverHost = System.getProperty("host");
        try {
            client.startConnection(serverHost, 6666);
            DataInputStream in = client.in;
            long st = System.currentTimeMillis();
            int counter = 1_000_000;
            while(counter > 0) {
                int v = in.readInt();
//                System.out.println("v: " + v);
                counter--;
            }

            long pt = System.currentTimeMillis() - st;
            System.out.println("Process time of TCP raw: " + pt);
        } finally {
            client.stopConnection();
        }
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216

1 Answers1

4

I can push 1 million messages between two machines with Aeron in a fraction of a second. It is likely your benchmark could be improved. Try get familiar with a framework like JMH and understand what is actually being measured. There are Aeron (and other messaging) benchmarks here - https://github.com/real-logic/benchmarks.

Martin Thompson
  • 1,341
  • 8
  • 11
  • Am I understand correctly that these benchmarks are the round trip latency on single machine? – trunghuynh.cse Mar 21 '23 at 01:50
  • They are round trip benchmarks that can be configured to be on the same machine with IPC or UDP, and across machines with UDP. That is a configuration option. – Martin Thompson Mar 21 '23 at 08:21