Class RoundTrip

java.lang.Object
org.jgroups.tests.RoundTrip
All Implemented Interfaces:
RtReceiver

public class RoundTrip extends Object implements RtReceiver
Class that measure RTT for multicast messages between 2 cluster members. See RpcDispatcherSpeedTest for RPCs. Note that request and response times are measured using System.nanoTime() which might yield incorrect values when run on different cores, so these numbers may not be reliable.

Running this on different nodes will not yield correct results for request- and response-latencies, but should be ok for round-trip times. *If* times across nodes are synchronized, flag -use-wall-clock can switch to currentTimeMillis() which gives more meaningful results for request- and response-latency across boxes.

  • Field Details

  • Constructor Details

    • RoundTrip

      public RoundTrip(boolean use_ms)
  • Method Details

    • start

      protected void start(String transport, String[] args) throws Exception
      Throws:
      Exception
    • receive

      public void receive(Object sender, byte[] req_buf, int offset, int length)
      On the server: receive a request, send a response. On the client: send a request, wait for the response
      Specified by:
      receive in interface RtReceiver
      Parameters:
      sender - The address of the sender
      req_buf - The buffer
      offset - The offset of the data in the buffer
      length - The length (bytes) of the data
    • loop

      protected void loop()
    • sendRequests

      protected void sendRequests() throws Exception
      Throws:
      Exception
    • print

      protected String print(AverageMinMax avg)
    • time

      protected static long time(boolean use_ms)
    • unit

      protected String unit()
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception
    • help

      protected static void help(String transport)
    • create

      protected static RtTransport create(String transport) throws Exception
      Throws:
      Exception
    • availableTransports

      protected static String availableTransports()
    • printOptions

      protected static String printOptions(String[] opts)