- Bird's eye overview
- Quick action -- running a benchmark without much ado
- Conceptual overview
- Benchmark operation
- Parametrisation – source pins and and benchmarking profiles
- Deployment state handling
- The benchmarking process
- The capture process
- Benchmark results
The benchmarking infrastructure consists of the following components:
- The
cardano-benchmarkingrepository, which contains:- log analysis scripts, in the
scripts/subdirectory - the
cardano-tx-generator, that generates Tx load on arbitrary nodes, - a NixOS service definition for the generator, in
nix/nixos/tx-generator-service.nix
- log analysis scripts, in the
- The
cardano-opsrepository, with:- the general cluster deployment infrastructure,
- a specific, benchmarking-oriented deployment type, defined in
globals-bench-txgen-simple.nix, - the
benchscript, that automates benchmark runs.
- A number of cluster deployments, on the development deployer, that
have
cardano-opscheckouts & benchmarking configuration set up in each of them, in the form ofbenchmarking-cluster-params.jsonfiles.
-
Clusters
Benchmarking clusters are available on the development deployer, and currently include:
- remote-dev-cluster-3
- remote-dev-cluster-6
- remote-dev-cluster-9
- remote-dev-cluster-12
-
The
benchcommandBenchmarking clusters are controlled using the
benchcommand, which is equivalent to an alias of./scripts/bench.shin the current development checkout.The command automates a significant part of the benchmarking workflow:
- definition of multiple benchmarking profiles
- generating genesis
- deploying the cluster
- running the benchmark profiles
- collecting & doing basic analysis on the logs
- packaging the profile run data
The command has a fairly helpful
--help&--help-fullflags.
-
Access the cluster deployment environment:
- log into the development deployer
cd $CLUSTER- update the
cardano-opscheckout to the desired version - enter the
nix-shell
-
Ensure the cluster params file (
benchmarking-cluster-params.json) is up-to-date with the currentcardano-opscheckout:bench reinit-paramsThis step is only necessary when
cardano-opsis updated in a major way, which is rarely the case. -
The easiest way to run the full suite of benchmark profiles is to issue:
bench allThat's it!
-
Otherwise, if willing to benchmark just a single profile, we might need to redeploy the cluster:
bench deployThis is, generally speaking, only necessary in the following situations:
- after genesis update (which is performed by
bench genesis), and - after
cardano-nodepin changes.
- after genesis update (which is performed by
-
At this point you are prepared to run a benchmark – either for a single profile:
bench bench-profile [PROFILE]The profile name is optional, and defaults to
default, which refers to a profile specified in the cluster params file (see the.meta.default_profileJSON key).Normally, the default profile is the first one listed.
-
Every benchmark run provides an archive at the root of the cluster's deployment checkout, f.e.:
2020-05-19-22.21.dist6-50000tx-100b-1i-1o-100tps.tar.xz
The pipeline can be described in terms of the following concepts, which we enumerate here shortly, but will also revisit in depth later:
-
Source pins for the components (
cardano-node,cardano-db-syncandcardano-benchmarkingrepositories). -
Benchmarking parameters, maintained in
benchmarking-cluster-params.json, carry the benchmarking profiles. -
Benchmarking profiles are contained in benchmarking parameters, and parametrise the cluster genesis and transaction generator.
-
Cluster components: the producers hosts, which mint blocks, and the explorer host, which generates transactions and serves as a point of observation.
-
Deployment checkout is a per-cluster checkout of the
cardano-opsrepository, that is situated in the home directory of thedevuser on the development deployer. After checkout initialisation (see:bench init N) it is extended by the benchmarking parameters file,benchmarking-cluster-params.json. -
The deployment state, which is implicit in the cluster component states, but also summarised in the deployment state files –
deployment-explorer.jsonanddeployment-producers.json. -
The genesis is parametrised by the benchmarking profile, and, once changed (perhaps due to benchmarking profile selection), necessitates redeployment of all cluster components.
-
The deployment process, which affects the deployment state, and updates its summaries in the deployment state files.
-
The benchmarking process, which is defined by the deployment state, and so, indirectly, by the source pins and the chosen benchmarking profile.
It consists of several phases: cleanup, initialisation, registration, generation and termination.
-
Benchmarking run is a closely related concept that denotes a particular, parametrised instance of the benchmarking process, that was executed at a certain time.
Each benchmarking run is assigned a unique tag, that coincides with the name of a subdirectory under
./runsin the deployment checkout. -
The benchmarking batch is a set of benchmarking runs for all benchmarking profiles defined by the benchmarking parameters of the particular cluster..
-
The capture process, that follows the benchmarking process, collects and processes the post-benchmarking cluster state, and ultimately provides the benchmark results.
It consists of: log fetching, analysis and packaging.
-
Benchmark results, consist of the logs and results of their analysis.
WARNING 1: it is strongly discouraged to edit the cardano-ops
deployment checkout, as this severely impedes collaboration.
It is, instead, advised to add on the developer's machine, a remote for
the cardano-ops deployment checkout, and push to that. Note, that even
the branch currently checked out on the deployer can be pushed to – the
checkout will be magically updated, provided there were no local
changes.
WARNING 2: it is strongly discouraged to operate the cluster outside
of the permanent screen session on the dev deployer – this raises the
possibilty of conflicting deployments and discarded benchmark results.
It's easy to join the screen session:
screen -x bench
TODO
-
Source pins
Source pins specify versions of software components deployed on the benchmarking cluster.
Following pins are relevant in the benchmarking context:
cardano-node, stored innix/sources.bench-txgen-simple.jsoncardano-db-sync, stored innix/sources.bench-txgen-simple.jsoncardano-benchmarking, stored innix/sources.json
These pins can be automatically updated to match a particular branch or tag using
niv, which is available inside thenix-shellatcardano-ops:niv -s SOURCES-JSON-FILE update REPO-NAME --branch BRANCH-OR-TAG -
Profiles and the benchmarking cluster parameters file
Each benchmarking cluster obtains its profile definitions and other metadata from a local file called
./benchmarking-cluster-params.json.This cluster parameterisation file is generated, and the generator accepts a single parameter – cluster size:
bench init-params 3This produces a JSON object, that defines benchmarking profiles (except for its
metacomponent, which carries things like node names and genesis configuration).Benchmarking profiles serve as named sets of parameters for benchmarking runs, and can be listed with:
bench list-profiles # ..or just 'bench ps'As mentioned in the Quick action section, we can run benchmarks per-profile:
bench bench-profile dist3-50000tx-100b-1i-1o-100tps # defaults to 'default'..or for all defined profiles:
bench bench-all-
Changing the set of available profiles
It's not advised to edit the cluster parameters file directly – because doing so would force us to update this file manually, whenever the
benchscript changes – we should, instead, change the definition of its generator.Note that this is still currently a bit ad-hoc, but will improve, once the declarative definition for the profile specs is implemented.
-
-
State handling
There is an ongoing effort to handle deployment state transparently, on a minimal, as-needed basis – as implied by the benchmarking process.
We'll only cover this shortly, therefore:
-
genesis can be generated for a particular profile by:
bench genesis [PROFILE=default] -
deployment can be initiated by:
bench deploy [PROFILE=default]
-
TODO
-
Cleanup
-
Initialisation
-
Registration
-
Generation
-
Termination
TODO
-
Log fetching
-
Analysis
-
Packaging
Each successful benchmark run produces the following results:
-
A run output directory, such as:
./runs/1589819135.27a0a9dc.refinery-manager.pristine.node-66f0e6d4.tx50000.l100.i1.o1.tps100This directory (also called "tag", internally), contains:
-
meta.json– the run's metadata, a key piece in its processing, -
a copy of
benchmarking-cluster-params.json, taken during the registration phase of the benchmark process, -
deployment state summaries of the cluster components, taken during the registration phase of the benchmark process:
deployment-explorer.jsonanddeployment-producer.json, -
meta/*– some miscellaneous run metadata, -
logs/*– various logs, both deployment, service startup and runtime, for all the nodes (including explorer) and the Tx generator. This also includes an extraction from thecardano-db-syncdatabase. -
analysis/*– some light extraction based on the available logs. -
tools/*– the tools used to perform the above extraction, fetched from thecardano-benchmarkingrepo.
-
-
An archive in the deployment checkout, that contains the exact content of that directory, but placed in a directory with a user-friendly name:
./YYYY-MM-DD.$PROFILE_NAME.tar.xz