Skip to content

Commit

Permalink
Generalise benchmarking scripts to work for N nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
oneEdoubleD authored and CodiePP committed Jul 3, 2020
1 parent caeee23 commit 2a27595
Show file tree
Hide file tree
Showing 15 changed files with 852 additions and 0 deletions.
57 changes: 57 additions & 0 deletions benchmarks/shelley3pools/benchmark-generic.sh
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

# preparation
BASEDIR=$(realpath $(dirname "$0"))
. "${BASEDIR}"/../../scripts/common.sh

##prebuild 'cardano-tx-generator' || exit 1
#prebuild 'cardano-rt-view' || exit 1
prebuild 'cardano-node' || exit 1
prebuild 'cardano-cli' || exit 1

export CLICMD="run cardano-cli"

TMUX_ENV_PASSTHROUGH=(
"export era=shelley; export DBDIR=${DBDIR}; export SOCKETDIR=${SOCKETDIR};"
"export SCRIPTS_LIB_SH_MODE=${SCRIPTS_LIB_SH_MODE};"
"export __COMMON_SRCROOT=${__COMMON_SRCROOT};"
"export DEFAULT_DEBUG=${DEFAULT_DEBUG};"
"export DEFAULT_VERBOSE=${DEFAULT_VERBOSE};"
"export DEFAULT_TRACE=${DEFAULT_TRACE};"
"$(nix_cache_passthrough)"
)


# 0 cleanup
rm -rf ./db/* ./logs/*
mkdir -p logs/sockets

# 1 prepare genesis
./prepare_genesis.sh

# 2 run rt-view
tmux select-window -t :0
tmux new-window -n RTview \
"${TMUX_ENV_PASSTHROUGH[*]} ./run-rt-view.sh; $SHELL"
sleep 1

# 3 run pools
tmux select-window -t :0
tmux new-window -n Nodes \
"${TMUX_ENV_PASSTHROUGH[*]} ./run-Npools.sh; $SHELL"
sleep 2

# 4 run tx-gen
tmux select-window -t :0
tmux new-window -n TxGen \
"sleep 7; ${TMUX_ENV_PASSTHROUGH[*]} ./run-tx-generator.sh; $SHELL"
sleep 30

# 5 send delegation transactions
tmux select-window -t :0
tmux new-window -n Delegation \
"sleep 5; ${TMUX_ENV_PASSTHROUGH[*]} ./submit_delegation_tx.sh; $SHELL"

tmux select-window -t Nodes
sleep 1
$SHELL
11 changes: 11 additions & 0 deletions benchmarks/shelley3pools/configuration-generator.sh
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

. ./configuration/parameters

NNODES=${NNODES:-3}

for i in $(seq 1 ${NNODES})
do
cp ./configuration/configuration-template.yaml ./configuration/configuration-node-${i}.yaml
sed -i "s/<CHANGE_ME_TO_NODE_ID>/${i}/g" ./configuration/configuration-node-${i}.yaml
done
279 changes: 279 additions & 0 deletions benchmarks/shelley3pools/configuration/configuration-template.yaml
@@ -0,0 +1,279 @@
##########################################################
############### Mainnet #########
############### Cardano Byron Node Configuration #########
##########################################################


##### Locations #####

GenesisFile: genesis/genesis.json

##### Core protocol parameters #####

# This is the instance of the Ouroboros family that we are running.
# The node also supports various test and mock instances.
# "RealPBFT" is the real (ie not mock) (permissive) OBFT protocol, which
# is what we use on mainnet in Byron era.
Protocol: TPraos

# The mainnet does not include the network magic into addresses. Testnets do.
RequiresNetworkMagic: RequiresMagic


##### Update system parameters #####

# This protocol version number gets used by by block producing nodes as part
# part of the system for agreeing on and synchronising protocol updates.
LastKnownBlockVersion-Major: 0
LastKnownBlockVersion-Minor: 2
LastKnownBlockVersion-Alt: 0

# In the Byron era some software versions are also published on the chain.
# We do this only for Byron compatibility now.
ApplicationName: cardano-sl
ApplicationVersion: 1


##### Logging configuration #####

# The node can run in either the SimpleView or LiveView. The SimpleView just
# uses standard output, optionally with log output. The LiveView is a text
# console on Linux and Mac OSX with a live view of various node metrics.
# When LiveView is used logging output to 'stdout' is automatically disabled.
#ViewMode: SimpleView
ViewMode: LiveView

# Enble or disable logging overall
TurnOnLogging: True

# Enable the collection of various OS metrics such as memory and CPU use.
# These metrics are traced in the context name: 'cardano.node-metrics' and can
# be directed to the logs or monitoring backends.
TurnOnLogMetrics: True

# Global logging severity filter. Messages must have at least this severity to
# pass. Typical values would be Warning, Notice, Info or Debug.
minSeverity: Debug

# Log items can be rendered with more or less verbose detail.
# Verbosity ranges from MinimalVerbosity, NormalVerbosity to MaximalVerbosity
TracingVerbosity: MaximalVerbosity

# The system supports a number of backends for logging and monitoring.
# This setting lists the the backends that will be available to use in the
# configuration below. The logging backend is called Katip.
setupBackends:
- KatipBK
# - TraceForwarderBK

# This specifies the default backends that trace output is sent to if it
# is not specifically configured to be sent to other backends.
defaultBackends:
- KatipBK
# - TraceForwarderBK

# EKG is a simple metrics monitoring system. Uncomment the following to enable
# this backend and listen on the given local port and point your web browser to
# http://localhost:12788/
hasEKG: 12788

# The Prometheus monitoring system exports EKG metrics. Uncomment the following
# to listen on the given port. Output is provided on
# http://localhost:12798/metrics
hasPrometheus:
- "127.0.0.1"
- 12798

# To enable the 'TraceForwarder' backend, uncomment the following setting. Log
# items are then forwarded based on an entry in 'mapBackends' to a separate
# process running a 'TraceAcceptor'.
# Example using UNIX pipes:
#traceForwardTo:
# tag: RemotePipe
# contents: "logs/sockets/pool1"
#
# Example using Windows named pipes:
# traceForwardTo:
# tag: RemotePipe
# contents: "\\\\.\\pipe\\acceptor"
#
# Example using network socket:
# traceForwardTo:
# tag: RemoteSocket
# contents:
# - "127.0.0.1"
# - "2997"

# For the Katip logging backend we must set up outputs (called scribes)
# The available types of scribe are:
# FileSK for files
# StdoutSK/StderrSK for stdout/stderr
# JournalSK for systemd's journal system
# DevNullSK ignores all output
# The scribe output format can be ScText or ScJson. Log rotation settings can
# be specified in the defaults below or overidden on a per-scribe basis here.
setupScribes:
- scKind: FileSK
scName: "logs/node<CHANGE_ME_TO_NODE_ID>.json"
scFormat: ScJson
- scKind: FileSK
scName: "logs/node<CHANGE_ME_TO_NODE_ID>.log"
scFormat: ScText

# For the Katip logging backend this specifies the default scribes that trace
# output is sent to if it is not configured to be sent to other scribes.
defaultScribes:
- - FileSK
- "logs/node<CHANGE_ME_TO_NODE_ID>.json"
- - FileSK
- "logs/node<CHANGE_ME_TO_NODE_ID>.log"

# The default file rotation settings for katip scribes, unless overridden
# in the setupScribes above for specific scribes.
rotation:
rpLogLimitBytes: 15000000
rpKeepFilesNum: 100
rpMaxAgeHours: 24


##### Coarse grained logging control #####

# Trace output from whole subsystems can be enabled/disabled using the following
# settings. This provides fairly coarse grained control, but it is relatively
# efficient at filtering out unwanted trace output.

# Trace BlockFetch client.
TraceBlockFetchClient: False

# Trace BlockFetch decisions made by the BlockFetch client.
# needed to display "peers" and their block height in LiveView
TraceBlockFetchDecisions: True

# Trace BlockFetch protocol messages.
TraceBlockFetchProtocol: False

# Serialised Trace BlockFetch protocol messages.
TraceBlockFetchProtocolSerialised: False

# Trace BlockFetch server.
TraceBlockFetchServer: False

# Verbose tracer of ChainDB
TraceChainDb: True

# Trace ChainSync client.
TraceChainSyncClient: False

# Trace ChainSync server (blocks).
TraceChainSyncBlockServer: False

# Trace ChainSync server (headers)
TraceChainSyncHeaderServer: False

# Trace ChainSync protocol messages.
TraceChainSyncProtocol: False

# Trace DNS Resolver messages.
TraceDNSResolver: True

# Trace DNS Subscription messages.
TraceDNSSubscription: True

# Trace error policy resolution.
TraceErrorPolicy: True

# Trace local error policy resolution.
TraceLocalErrorPolicy: True

# Trace block forging.
TraceForge: True

# Trace Handshake protocol messages.
TraceHandshake: False

# Trace IP Subscription messages.
TraceIpSubscription: True

# Trace local ChainSync protocol messages.
TraceLocalChainSyncProtocol: False

# Trace local Handshake protocol messages.
TraceLocalHandshake: False

# Trace local TxSubmission protocol messages.
TraceLocalTxSubmissionProtocol: False

# Trace local TxSubmission server.
TraceLocalTxSubmissionServer: False

# Trace mempool.
TraceMempool: True

# Trace Mux Events
TraceMux: False

# Trace TxSubmission server (inbound transactions).
TraceTxInbound: False

# Trace TxSubmission client (outbound transactions).
TraceTxOutbound: False

# Trace TxSubmission protocol messages.
TraceTxSubmissionProtocol: False


##### Fine grained logging control #####

# It is also possible to have more fine grained control over filtering of
# trace output, and to match and route trace output to particular backends.
# This is less efficient than the coarse trace filters above but provides
# much more precise control.

options:

# This routes metrics matching specific names to particular backends.
# This overrides the 'defaultBackends' listed above. And note that it is
# an override and not an extension so anything matched here will not
# go to the default backend, only to the explicitly listed backends.
mapBackends:
cardano.node.BlockFetchDecision.peers:
- TraceForwarderBK
- EKGViewBK
- kind: UserDefinedBK
name: LiveViewBackend
cardano.node.ChainDB.metrics:
- TraceForwarderBK
- EKGViewBK
- kind: UserDefinedBK
name: LiveViewBackend
cardano.node.metrics:
- TraceForwarderBK
- EKGViewBK
- kind: UserDefinedBK
name: LiveViewBackend
cardano.node.Forge.metrics:
- TraceForwarderBK
- EKGViewBK
cardano.node.release:
- TraceForwarderBK
- KatipBK
cardano.node.version:
- TraceForwarderBK
- KatipBK
cardano.node.commit:
- TraceForwarderBK
- KatipBK

# redirects traced values to a specific scribe which is identified by its
# type and its name, separated by "::":
mapScribes:
cardano.node-metrics:
- "FileSK::logs/node<CHANGE_ME_TO_NODE_ID>.json"

# apply a filter on message severity on messages in a specific named context.
# this filter is applied additionally to the global 'minSeverity' and thus
# needs to be at least as high.
mapSeverity:
cardano.node.ChainDB: Info
cardano.node.DnsSubscription: Info

5 changes: 5 additions & 0 deletions benchmarks/shelley3pools/configuration/topology-node-1.json
@@ -1,5 +1,10 @@
{
"Producers": [
{
"addr": "127.0.0.1",
"port": 3003,
"valency": 1
},
{
"addr": "127.0.0.1",
"port": 3002,
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/shelley3pools/configuration/topology-node-2.json
@@ -1,5 +1,10 @@
{
"Producers": [
{
"addr": "127.0.0.1",
"port": 3003,
"valency": 1
},
{
"addr": "127.0.0.1",
"port": 3002,
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/shelley3pools/configuration/topology-node-3.json
@@ -1,5 +1,10 @@
{
"Producers": [
{
"addr": "127.0.0.1",
"port": 3003,
"valency": 1
},
{
"addr": "127.0.0.1",
"port": 3000,
Expand Down

0 comments on commit 2a27595

Please sign in to comment.