Package org.jgroups.tests.perf
Class MPerf
- java.lang.Object
-
- org.jgroups.tests.perf.MPerf
-
- All Implemented Interfaces:
Receiver
public class MPerf extends java.lang.Object implements Receiver
Dynamic tool to measure multicast performance of JGroups; every member sends N messages and we measure how long it takes for all receivers to receive them. All messages received from a member P are checked for ordering and non duplicity. MPerf is dynamic because it doesn't accept any configuration parameters (besides the channel config file and name); all configuration is done at runtime, and will be broadcast to all cluster members.- Since:
- 3.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMPerf.ConfigChangeprotected static classMPerf.Configurationprotected static classMPerf.MessageCounterprotected static classMPerf.MPerfHeaderprotected static classMPerf.Resultprotected classMPerf.Sender
-
Field Summary
Fields Modifier and Type Field Description protected JChannelchannelprotected booleandisplay_msg_srcprotected static shortIDprotected Addresslocal_addrprotected Loglogprotected booleanlog_localprotected booleanloopingprotected java.util.List<Address>membersprotected intmsg_sizeprotected intnum_sendersprotected intnum_threadsprotected booleanoobprotected java.nio.file.Pathout_file_pathprotected MPerf.MessageCounterreceived_msgs_mapprotected ResponseCollector<MPerf.Result>resultsprotected longstart_timeprotected ThreadFactorythread_factoryprotected inttime
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.lang.StringcomputeStats(long time, long msgs, int size)protected voidconfigChange(java.lang.String name)protected voiddisplayResults()protected voideventLoop()protected java.util.List<Address>getSenders()Returns all members if num_senders <= 0, or the members with rank <= num_sendersprotected voidhandleConfigChange(MPerf.ConfigChange config_change)protected voidhandleConfigRequest(Address sender)protected voidhandleConfigResponse(MPerf.Configuration cfg)static voidmain(java.lang.String[] args)protected java.lang.StringprintAverage(long start_time)protected voidprintOutput(java.lang.String s)protected java.lang.StringprintParameters()protected static java.lang.StringprintPerSender(Address[] sender, long[] received, long msg_size, long diff)voidreceive(Message msg)Called when a message is received.voidreceive(MessageBatch batch)Called when a batch of messages is receivedprotected voidsend(Address target, java.lang.Object payload, byte header, Message.Flag... flags)protected MPerf.ResultsendMessages(boolean isSender)protected voidsendNoException(Address target, java.lang.Object payload, byte header, Message.Flag... flags)voidsetOutPath(java.nio.file.Path out_file_path)voidstart(java.lang.String props, java.lang.String name, boolean use_fibers)protected voidstartTest()voidstop()voidviewAccepted(View view)Called when a change in membership has occurred.
-
-
-
Field Detail
-
channel
protected JChannel channel
-
local_addr
protected Address local_addr
-
time
protected int time
-
msg_size
protected int msg_size
-
num_threads
protected int num_threads
-
num_senders
protected int num_senders
-
oob
protected boolean oob
-
log_local
protected boolean log_local
-
display_msg_src
protected boolean display_msg_src
-
start_time
protected long start_time
-
received_msgs_map
protected MPerf.MessageCounter received_msgs_map
-
members
protected final java.util.List<Address> members
-
log
protected final Log log
-
out_file_path
protected java.nio.file.Path out_file_path
-
looping
protected boolean looping
-
results
protected final ResponseCollector<MPerf.Result> results
-
thread_factory
protected ThreadFactory thread_factory
-
ID
protected static final short ID
-
-
Method Detail
-
start
public void start(java.lang.String props, java.lang.String name, boolean use_fibers) throws java.lang.Exception- Throws:
java.lang.Exception
-
setOutPath
public void setOutPath(java.nio.file.Path out_file_path)
-
eventLoop
protected void eventLoop()
-
startTest
protected void startTest() throws java.lang.Exception- Throws:
java.lang.Exception
-
displayResults
protected void displayResults()
-
printParameters
protected java.lang.String printParameters()
-
printOutput
protected void printOutput(java.lang.String s)
-
configChange
protected void configChange(java.lang.String name) throws java.lang.Exception- Throws:
java.lang.Exception
-
sendNoException
protected void sendNoException(Address target, java.lang.Object payload, byte header, Message.Flag... flags)
-
send
protected void send(Address target, java.lang.Object payload, byte header, Message.Flag... flags) throws java.lang.Exception
- Throws:
java.lang.Exception
-
stop
public void stop()
-
receive
public void receive(Message msg)
Description copied from interface:ReceiverCalled when a message is received.
-
receive
public void receive(MessageBatch batch)
Description copied from interface:ReceiverCalled when a batch of messages is received
-
getSenders
protected java.util.List<Address> getSenders()
Returns all members if num_senders <= 0, or the members with rank <= num_senders
-
handleConfigChange
protected void handleConfigChange(MPerf.ConfigChange config_change)
-
handleConfigRequest
protected void handleConfigRequest(Address sender) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleConfigResponse
protected void handleConfigResponse(MPerf.Configuration cfg)
-
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 MPerf.Result sendMessages(boolean isSender)
-
printAverage
protected java.lang.String printAverage(long start_time)
-
computeStats
protected static java.lang.String computeStats(long time, long msgs, int size)
-
printPerSender
protected static java.lang.String printPerSender(Address[] sender, long[] received, long msg_size, long diff)
-
main
public static void main(java.lang.String[] args) throws java.io.IOException- Throws:
java.io.IOException
-
-