What is the harness?
It's a tool that allows running test scenarios against an rchain network.
So, what is the harness?
A grpc client extracted from the rchain project and bridged to gatling (gatling.io).
Where can it be found?
https://github.com/lukasz-golebiewski-org/rchain-perf-harness in the folder templater
It should become part of rchain soon.
How can I use it?
Prerequisite: an rchain network running (e.g. one standalone node).
Three approaches to running the harness:
- run it as a test
- run it as a standalone application
- bypass gatling and run it directly
Ad. 1)
Code Block |
---|
coop.rchain.perf.DeployProposeSimulation |
This simulation is configured in templater/runner/test/reources/appliaction.conf
Code Block |
---|
rnodes=["localhost:40401", "127.0.0.1:40401"] |
sbt runner/gatling:test
Ad. 2)
coop.rchain.perf.ContinuousRunner
This is a typical Main
style app. behaves similar to the above simulation but can be run
instead of tested
.
The params are as follows:
Code Block |
---|
#!/bin/bash set -axe java -Dhosts="$1" -Dpath=$2 -Dsessions=$3 -Dratio=$4 -Dloops=$5 -jar ./runner.jar |
Ad. 3)
coop.rchain.perf.Runner
Code Block |
---|
object Propose { def propose(session: Session)( client: ClientWithDetails): (Session, DeployServiceResponse) = { (session.remove("client"), client.client.createBlock(Empty())) } } object Deploy { def deploy(session: Session)( client: ClientWithDetails): (Session, DeployServiceResponse) = { val (_, contract): (String, String) = session("contract") .as[(String, String)] val d = DeployData() .withTimestamp(System.currentTimeMillis()) .withTerm(contract) .withFrom("0x1") .withPhloLimit(0) .withPhloPrice(0) .withNonce(0) (session.set("client", client), client.client.doDeploy(d)) } } |
You can use these in any way.
But I don't have a network!
There is There a myriad ways of setting up a network:
- p2p tool (RNode Integration Testing Tool )
./scripts/p2p-test-tool.py -b -p 5 -i rchain/rnode:dev
assembly jar
Code Block java -jar rnode-assembly-0.6.1.jar run -s --validator-private-key f7a9f1...9 --host localhost
- a templating tool https://github.com/lukasz-golebiewski-org/rchain-perf-harness/blob/master/init.sh
- run
Main
(https://github.com/rchain/rchain/blob/dev/node/src/main/scala/coop/rchain/node/Main.scala) - use the binary from (https://repo.pyr8.io/rchain/downloads/)
Problems
Dupe Contract
We encountered an issue with the contract:
Code Block |
---|
contract @"dupe"(@depth) = { if (depth <= 0) { Nil } else { @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) | @"dupe"!(depth-1) } } | @"dupe"!(5) |
The scenario was as follows:
10 deploys, 1 propose, 10 threads running "at once", 100 loops. A network of 5 rnodes.
The problem observed was Kamon Http client crashing. I think that this is a GC issue but I did not get the heap dumps to prove itthrowing exceptions. This was most likely due to node running out of memory and becoming unstable.
A good starting point would be to reproduce, make sure it's the heap running out and getting heap dumps.