Class 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
    • Field Detail

      • 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
      • 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
      • ID

        protected static final short ID
    • Constructor Detail

      • MPerf

        public MPerf()
              throws java.io.IOException
        Throws:
        java.io.IOException
      • MPerf

        public MPerf​(java.nio.file.Path out_file_path)
              throws java.io.IOException
        Throws:
        java.io.IOException
    • 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: Receiver
        Called when a message is received.
        Specified by:
        receive in interface Receiver
        Parameters:
        msg - The message
      • receive

        public void receive​(MessageBatch batch)
        Description copied from interface: Receiver
        Called when a batch of messages is received
        Specified by:
        receive in interface Receiver
        Parameters:
        batch - The message batch
      • 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
      • viewAccepted

        public void viewAccepted​(View view)
        Description copied from interface: Receiver
        Called 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 when JChannel.connect(String) returns.
        Specified by:
        viewAccepted in interface Receiver
      • 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