Package org.jgroups.tests
Class RoundTrip
- java.lang.Object
-
- org.jgroups.tests.RoundTrip
-
- All Implemented Interfaces:
RtReceiver
public class RoundTrip extends java.lang.Object implements RtReceiver
Class that measure RTT for multicast messages between 2 cluster members. SeeRpcDispatcherSpeedTestfor RPCs. Note that request and response times are measured usingSystem.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classRoundTrip.Sender
-
Field Summary
Fields Modifier and Type Field Description protected booleandetailsprotected static byteDONEprotected intnum_msgsprotected intnum_sendersstatic intPAYLOADprotected static byteREQprotected AverageMinMaxreq_latencyprotected static byteRSPprotected AverageMinMaxrsp_latencyprotected RoundTrip.Sender[]sendersprotected RtTransporttpprotected static java.util.Map<java.lang.String,java.lang.String>TRANSPORTSprotected booleanuse_ms
-
Constructor Summary
Constructors Constructor Description RoundTrip(boolean use_ms)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.lang.StringavailableTransports()protected static RtTransportcreate(java.lang.String transport)protected static voidhelp(java.lang.String transport)protected voidloop()static voidmain(java.lang.String[] args)protected java.lang.Stringprint(AverageMinMax avg)protected static java.lang.StringprintOptions(java.lang.String[] opts)voidreceive(java.lang.Object sender, byte[] req_buf, int offset, int length)On the server: receive a request, send a response.protected voidsendRequests()protected voidstart(java.lang.String transport, java.lang.String[] args)protected static longtime(boolean use_ms)protected java.lang.Stringunit()
-
-
-
Field Detail
-
tp
protected RtTransport tp
-
num_msgs
protected int num_msgs
-
num_senders
protected int num_senders
-
details
protected boolean details
-
use_ms
protected boolean use_ms
-
REQ
protected static final byte REQ
- See Also:
- Constant Field Values
-
RSP
protected static final byte RSP
- See Also:
- Constant Field Values
-
DONE
protected static final byte DONE
- See Also:
- Constant Field Values
-
PAYLOAD
public static final int PAYLOAD
- See Also:
- Constant Field Values
-
senders
protected RoundTrip.Sender[] senders
-
req_latency
protected final AverageMinMax req_latency
-
rsp_latency
protected final AverageMinMax rsp_latency
-
TRANSPORTS
protected static final java.util.Map<java.lang.String,java.lang.String> TRANSPORTS
-
-
Method Detail
-
start
protected void start(java.lang.String transport, java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
receive
public void receive(java.lang.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:
receivein interfaceRtReceiver- Parameters:
sender- The address of the senderreq_buf- The bufferoffset- The offset of the data in the bufferlength- The length (bytes) of the data
-
loop
protected void loop()
-
sendRequests
protected void sendRequests() throws java.lang.Exception- Throws:
java.lang.Exception
-
print
protected java.lang.String print(AverageMinMax avg)
-
time
protected static long time(boolean use_ms)
-
unit
protected java.lang.String unit()
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
help
protected static void help(java.lang.String transport)
-
create
protected static RtTransport create(java.lang.String transport) throws java.lang.Exception
- Throws:
java.lang.Exception
-
availableTransports
protected static java.lang.String availableTransports()
-
printOptions
protected static java.lang.String printOptions(java.lang.String[] opts)
-
-