Package org.jgroups.tests.perf
Class MPerfRpc
- java.lang.Object
-
- org.jgroups.tests.perf.MPerfRpc
-
- All Implemented Interfaces:
Receiver
public class MPerfRpc extends java.lang.Object implements Receiver
Dynamic tool to measure multicast RPC performance of JGroups; every member invokes N RPCs and we measure how long it takes for all receivers to receive them. Initially copied fromMPerf.- Since:
- 3.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMPerfRpc.ConfigChangeprotected static classMPerfRpc.Configurationprotected static classMPerfRpc.Resultprotected classMPerfRpc.Senderprotected classMPerfRpc.Stats
-
Field Summary
Fields Modifier and Type Field Description protected JChannelchannelprotected static shortclearResultsprotected static shortconfigChangeprotected static shortconfigReqprotected static shortconfigRspprotected RpcDispatcherdispprotected static shortexitprotected static java.text.NumberFormatformatprotected static shorthandleDataprotected booleaninitiatorprotected longlast_intervalprotected Addresslocal_addrprotected Loglogprotected intlog_intervalprotected booleanloopingprotected java.util.List<Address>membersprotected static java.lang.reflect.Method[]METHODSprotected intmsg_sizeprotected java.lang.Stringnameprotected intnum_msgsprotected intnum_sendersprotected intnum_threadsprotected booleanoobprotected java.lang.Stringpropsprotected intreceive_log_intervalprotected java.util.concurrent.ConcurrentMap<Address,MPerfRpc.Stats>received_msgsMaintains stats per sender, will be sent to perf originator when all messages have been receivedprotected static shortresultprotected Addressresult_collectorprotected ResponseCollector<MPerfRpc.Result>resultsprotected RequestOptionssend_optionsprotected static shortsendingDoneprotected static shortstartSendingprotected booleansyncprotected java.util.concurrent.atomic.AtomicLongtotal_received_msgs
-
Constructor Summary
Constructors Constructor Description MPerfRpc()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearResults()protected static java.lang.StringcomputeStats(long time, long msgs, int size)protected voidconfigChange(java.lang.String name)voidconfigChange(MPerfRpc.ConfigChange config_change)voidconfigReq(Address sender)voidconfigRsp(MPerfRpc.Configuration cfg)protected voiddisplayResults()voidexit()protected java.util.List<Address>getSenders()Returns all members if num_senders <= 0, or the members with rank <= num_sendersvoidhandleData(Address src, byte[] payload, long seqno, boolean check_order)protected java.lang.ObjectinvokeRpc(short method_id, Address dest, RequestOptions options, java.lang.Object... args)protected RspList<?>invokeRpc(short method_id, RequestOptions options, java.lang.Object... args)protected voidloop()static voidmain(java.lang.String[] args)voidresult(Address sender, MPerfRpc.Result res)Called when a result from a node is receivedvoidsendingDone(Address sender)protected voidsendMessages()voidstart(java.lang.String props, java.lang.String name)voidstartSending(Address initiator)voidstop()voidviewAccepted(View view)Called when a change in membership has occurred.
-
-
-
Field Detail
-
props
protected java.lang.String props
-
channel
protected JChannel channel
-
disp
protected RpcDispatcher disp
-
local_addr
protected Address local_addr
-
name
protected java.lang.String name
-
num_msgs
protected int num_msgs
-
msg_size
protected int msg_size
-
num_threads
protected int num_threads
-
log_interval
protected int log_interval
-
receive_log_interval
protected int receive_log_interval
-
num_senders
protected int num_senders
-
sync
protected boolean sync
-
oob
protected boolean oob
-
received_msgs
protected final java.util.concurrent.ConcurrentMap<Address,MPerfRpc.Stats> received_msgs
Maintains stats per sender, will be sent to perf originator when all messages have been received
-
total_received_msgs
protected final java.util.concurrent.atomic.AtomicLong total_received_msgs
-
members
protected final java.util.List<Address> members
-
log
protected final Log log
-
looping
protected boolean looping
-
last_interval
protected long last_interval
-
results
protected final ResponseCollector<MPerfRpc.Result> results
-
result_collector
protected volatile Address result_collector
-
initiator
protected volatile boolean initiator
-
send_options
protected RequestOptions send_options
-
format
protected static final java.text.NumberFormat format
-
handleData
protected static final short handleData
- See Also:
- Constant Field Values
-
startSending
protected static final short startSending
- See Also:
- Constant Field Values
-
sendingDone
protected static final short sendingDone
- See Also:
- Constant Field Values
-
result
protected static final short result
- See Also:
- Constant Field Values
-
clearResults
protected static final short clearResults
- See Also:
- Constant Field Values
-
configChange
protected static final short configChange
- See Also:
- Constant Field Values
-
configReq
protected static final short configReq
- See Also:
- Constant Field Values
-
configRsp
protected static final short configRsp
- See Also:
- Constant Field Values
-
exit
protected static final short exit
- See Also:
- Constant Field Values
-
METHODS
protected static final java.lang.reflect.Method[] METHODS
-
-
Method Detail
-
start
public void start(java.lang.String props, java.lang.String name) throws java.lang.Exception- Throws:
java.lang.Exception
-
loop
protected void loop()
-
displayResults
protected void displayResults()
-
configChange
protected void configChange(java.lang.String name) throws java.lang.Exception- Throws:
java.lang.Exception
-
invokeRpc
protected RspList<?> invokeRpc(short method_id, RequestOptions options, java.lang.Object... args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
invokeRpc
protected java.lang.Object invokeRpc(short method_id, Address dest, RequestOptions options, java.lang.Object... args) throws java.lang.Exception- Throws:
java.lang.Exception
-
stop
public void stop()
-
handleData
public void handleData(Address src, byte[] payload, long seqno, boolean check_order)
-
startSending
public void startSending(Address initiator)
-
sendingDone
public void sendingDone(Address sender)
-
result
public void result(Address sender, MPerfRpc.Result res)
Called when a result from a node is received
-
clearResults
public void clearResults()
-
configChange
public void configChange(MPerfRpc.ConfigChange config_change)
-
configReq
public void configReq(Address sender) throws java.lang.Exception
- Throws:
java.lang.Exception
-
configRsp
public void configRsp(MPerfRpc.Configuration cfg)
-
exit
public void exit()
-
getSenders
protected java.util.List<Address> getSenders()
Returns all members if num_senders <= 0, or the members with rank <= num_senders
-
viewAccepted
public void viewAccepted(View view)
Description copied from interface:ReceiverCalled when a change in membership has occurred. No long running actions, sending of messages or anything that could block should be done in this callback. If some long running action needs to be performed, it should be done in a separate thread.
Note that on reception of the first view (a new member just joined), the channel will not yet be in the connected state. This only happens whenJChannel.connect(String)returns.- Specified by:
viewAcceptedin interfaceReceiver
-
sendMessages
protected void sendMessages()
-
computeStats
protected static java.lang.String computeStats(long time, long msgs, int size)
-
main
public static void main(java.lang.String[] args)
-
-