Class ProgrammaticUPerf

java.lang.Object
org.jgroups.tests.perf.ProgrammaticUPerf
All Implemented Interfaces:
MethodInvoker, Receiver

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

    • channel

      private JChannel channel
    • local_addr

      private Address local_addr
    • disp

      private RpcDispatcher disp
    • groupname

      static final String groupname
      See Also:
    • members

      protected final List<Address> members
    • view

      protected volatile View view
    • looping

      protected volatile boolean looping
    • event_loop_thread

      protected Thread event_loop_thread
    • num_reads

      protected final LongAdder num_reads
    • num_writes

      protected final 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
    • START

      private static final short START
      See Also:
    • GET

      private static final short GET
      See Also:
    • PUT

      private static final short PUT
      See Also:
    • GET_CONFIG

      private static final short GET_CONFIG
      See Also:
    • SET_SYNC

      private static final short SET_SYNC
      See Also:
    • SET_OOB

      private static final short SET_OOB
      See Also:
    • SET_NUM_THREADS

      private static final short SET_NUM_THREADS
      See Also:
    • SET_TIME

      private static final short SET_TIME
      See Also:
    • SET_MSG_SIZE

      private static final short SET_MSG_SIZE
      See Also:
    • SET_ANYCAST_COUNT

      private static final short SET_ANYCAST_COUNT
      See Also:
    • SET_READ_PERCENTAGE

      private static final short SET_READ_PERCENTAGE
      See Also:
    • ALLOW_LOCAL_GETS

      private static final short ALLOW_LOCAL_GETS
      See Also:
    • QUIT_ALL

      private static final short QUIT_ALL
      See Also:
    • COUNTER

      private final AtomicInteger COUNTER
    • BUFFER

      private byte[] BUFFER
    • format

      protected static final String format
      See Also:
  • Constructor Details

    • ProgrammaticUPerf

      public ProgrammaticUPerf()
  • Method Details

    • 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(String name, AddressGenerator generator, String bind_addr, int bind_port, boolean udp, String mcast_addr, int mcast_port, String initial_hosts) throws Throwable
      Throws:
      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 Object invoke(Object target, short method_id, Object[] args) throws 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:
      Exception - Thrown if the invocation threw an exception. The real exception may be wrapped in an InvocationTargetException.
    • startTest

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

      public void quitAll()
    • printAverage

      protected String printAverage(long start_time)
    • get

      public byte[] get(int key)
    • put

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

      public PerfUtil.Config getConfig()
    • applyConfig

      protected void applyConfig(PerfUtil.Config config)
    • eventLoop

      public void eventLoop()
    • invoke

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

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

      static double parseReadPercentage() throws Exception
      Throws:
      Exception
    • parseAnycastCount

      int parseAnycastCount() throws Exception
      Throws:
      Exception
    • printView

      protected void printView()
    • print

      protected static String print(AverageMinMax avg, boolean details)
    • main

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

      static void help()