Benchmark test

Benchmark test is available as separate module performance of main project universa.

The whole module contains single method executing the benchmark.

Test parameters

  • PACK_SIZE - contracts are grouped in packs of PACK_SIZE+1 contract. You can control pack size with this parameter
  • PACKS_IN_BUNCH - packs are sent to node in bunches. This is done to reduce network latency influence on measured performance.
  • BUNCHES_PER_NODE - it is possible to send more than one bunch to node. Sending multiple bunches reduces the accuracy of measured performance but provide something you can call long term performace
  • TIME_BETWEEN_BUNCHES - is an interval in milliseconds kept between sending bunches. By changin this interval you can provide any desired load to the network.

Setting up own instance of Universa

You may want to run benchmark on your own instance of Universa network. Follow the instructions.

Running benchmark

  1. Build fat jar of the test by executing gradle :performance:fatJar from project root.
  2. Locate uniperformance.jar at ./performance/build/libs
  3. Execute java -jar uniperformance.jar

Benchmark stages

Acquire network topology

        System.out.println("Connecting to nodes...");
        String nodeUrl = "http://node-1-com.utoken.io:8080";
        Client client = new Client(nodeUrl,TestKeys.privateKey(0),null);
        final int NODES_COUNT = client.getNodes().size();

Constructed client downloads the node topology from url passed. This may point to any node of your own instance you've just set up.

Connect to nodes

        for (int i = 0; i < NODES_COUNT; i++) {
            clients.put(i,client.getClient(i));
            clients.get(i).ping();
        }

Connection to every node is established. Ping is a command executed through secure session. Executing this commang pre-creates session for later use.

Prepare contracts

Preparing contracts is a long process. It must be done before actual test starts as processing of those contracts takes less time than preparation. Prepared contracts are packs with PACK_SIZE+1 contracts in total.

Start the test

The actual test starts with marking start0 timestamp followed by uploading a single bunch to every node. This is done in parrallel.

In single bunch mode start1 timestamp is marked as soon as first upload is finished and start2 timestamp is marked as soon as finished last.

In multiple bunch mode upload goes with pauses until all bunches are uploaded.

Benchmarks start quering for its statuses after every contract is uploaded . Getting APPROVED status increase done counter.

When done counter reaches the total number of contracts end timestamp is marked.

Test results

Three TPS values are calculated then:

  • AVG0 displays the pure client-side TPS. The measurement is started at the moment when the first registration request is INITIATED. It doesn’t take into account neither the network latency nor the time to upload the contracts. AVG0 is always the lowest among all metrics.
  • AVG1 represents the server-side TPS. The measurement is started at the moment when the FIRST registration request is COMPLETED – the node got all the contracts and started the registration procedure . It takes the network latency into account and measures pure working time of the nodes.
  • AVG2 is very similar to AVG1. The difference is that measurement is started at the moment when the LAST registration request is COMPLETED – ALL the nodes got their contracts and started the registration procedures. A good test run will show the AVG1 and AVG2 values being very close to each other, as the requests are executed on different nodes in parallel hence will be completed nearly simultaneously.

AVG1 and AVG2 are only calculated in single bunch mode.