Class ProgrammaticUPerf

  • All Implemented Interfaces:
    MethodInvoker, Receiver

    public class ProgrammaticUPerf
    extends java.lang.Object
    implements Receiver, MethodInvoker
    Tests the UNICAST by invoking unicast RPCs between a sender and a receiver. Mimicks the DIST mode in Infinispan
    • Field Detail

      • local_addr

        private Address local_addr
      • members

        protected final java.util.List<Address> members
      • view

        protected volatile View view
      • looping

        protected volatile boolean looping
      • event_loop_thread

        protected java.lang.Thread event_loop_thread
      • num_reads

        protected final java.util.concurrent.atomic.LongAdder num_reads
      • num_writes

        protected final java.util.concurrent.atomic.LongAdder num_writes
      • sync

        protected boolean sync
      • oob

        protected boolean oob
      • num_threads

        protected int num_threads
      • time

        protected int time
      • msg_size

        protected int msg_size
      • anycast_count

        protected int anycast_count
      • read_percentage

        protected double read_percentage
      • allow_local_gets

        protected boolean allow_local_gets
      • print_invokers

        protected boolean print_invokers
      • print_details

        protected boolean print_details
      • COUNTER

        private final java.util.concurrent.atomic.AtomicInteger COUNTER
      • BUFFER

        private byte[] BUFFER
    • Constructor Detail

      • ProgrammaticUPerf

        public ProgrammaticUPerf()
    • Method Detail

      • getSync

        public boolean getSync()
      • setSync

        public void setSync​(boolean s)
      • getOOB

        public boolean getOOB()
      • setOOB

        public void setOOB​(boolean oob)
      • getNumThreads

        public int getNumThreads()
      • setNumThreads

        public void setNumThreads​(int t)
      • getTime

        public int getTime()
      • setTime

        public void setTime​(int t)
      • getMsgSize

        public int getMsgSize()
      • setMsgSize

        public void setMsgSize​(int t)
      • getAnycastCount

        public int getAnycastCount()
      • setAnycastCount

        public void setAnycastCount​(int t)
      • getReadPercentage

        public double getReadPercentage()
      • setReadPercentage

        public void setReadPercentage​(double r)
      • allowLocalGets

        public boolean allowLocalGets()
      • allowLocalGets

        public void allowLocalGets​(boolean a)
      • printInvokers

        public boolean printInvokers()
      • printInvokers

        public void printInvokers​(boolean p)
      • printDetails

        public boolean printDetails()
      • printDetails

        public void printDetails​(boolean p)
      • init

        public void init​(java.lang.String name,
                         AddressGenerator generator,
                         java.lang.String bind_addr,
                         int bind_port,
                         boolean udp,
                         java.lang.String mcast_addr,
                         int mcast_port,
                         java.lang.String initial_hosts)
                  throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • stop

        void stop()
      • startEventThread

        protected void startEventThread()
      • stopEventThread

        protected void stopEventThread()
      • viewAccepted

        public void viewAccepted​(View new_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
      • invoke

        public java.lang.Object invoke​(java.lang.Object target,
                                       short method_id,
                                       java.lang.Object[] args)
                                throws java.lang.Exception
        Description copied from interface: MethodInvoker
        An implementation invokes a method associated with a given ID and the given args against a target object
        Specified by:
        invoke in interface MethodInvoker
        Parameters:
        target - The object against which to invoke the method
        method_id - The ID of the method. The implementation must assign unique IDs and associate them somehow with a method to invoke
        args - The arguments of the invocation
        Returns:
        The result. It may be null if a method returns void
        Throws:
        java.lang.Exception - Thrown if the invocation threw an exception. The real exception may be wrapped in an InvocationTargetException.
      • startTest

        public PerfUtil.Results startTest()
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • quitAll

        public void quitAll()
      • printAverage

        protected java.lang.String printAverage​(long start_time)
      • get

        public byte[] get​(int key)
      • put

        public void put​(int key,
                        byte[] val)
      • eventLoop

        public void eventLoop()
      • invoke

        void invoke​(short method_id,
                    java.lang.Object... args)
             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • startBenchmark

        void startBenchmark()
        Kicks off the benchmark on all cluster nodes
      • parseReadPercentage

        static double parseReadPercentage()
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • parseAnycastCount

        int parseAnycastCount()
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • printView

        protected void printView()
      • print

        protected static java.lang.String print​(AverageMinMax avg,
                                                boolean details)
      • main

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

        static void help()