Skip to content

Commit

Permalink
CAD-1073 bench | db-sync: run as cardano-node
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Jul 1, 2020
1 parent bec1c41 commit 225724a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
9 changes: 4 additions & 5 deletions bench/bench.sh
Expand Up @@ -212,15 +212,14 @@ main() {
prof=$(params resolve-profile "$prof")
profjq "$prof" '.';;

bench-all | all ) op_bench 'all';;
bench-profile | profiles | profile | p )
profiles | profile | p )
op_bench "$@";;
profiles-jq | pjq )
local q=$1; shift
op_bench "jq($q)" "$@";;
smoke-test | smoke )
no_deploy=t
op_bench 'smoke';;
rerun-profile | rerun | re )
op_bench "$(jq --raw-output .meta.profile ./last-meta.json)";;
smoke-test | smoke ) op_bench 'smoke';;

list-runs | runs | ls )
ls -1 runs/*/meta.json | cut -d/ -f2;;
Expand Down
2 changes: 1 addition & 1 deletion bench/lib-params.sh
Expand Up @@ -49,7 +49,7 @@ def profile_name($gtor; $gsis):
, ($gtor.tps | tostring) + "tps"
, ($gtor.io_arity | tostring) + "io"
, ($gsis.max_block_size | . / 1000
| tostring) + "kblk"
| tostring) + "kb"
] | join("-");
[ { txs: 50000, add_tx_size: 100, io_arity: 1, tps: 100 }
Expand Down
36 changes: 31 additions & 5 deletions globals-bench-txgen-simple.nix
Expand Up @@ -36,10 +36,10 @@ let
reportDeployment = x:
__trace "DEPLOYMENT_METADATA=${__toFile "nixops-metadata.json" (__toJSON metadata)}" x;

benchmarkingLogConfig = {
benchmarkingLogConfig = name: {
defaultScribes = [
[ "StdoutSK" "stdout" ]
[ "FileSK" "/var/lib/cardano-node/logs/node.json" ]
[ "FileSK" "/var/lib/cardano-node/logs/${name}.json" ]
];
setupScribes = [
{
Expand All @@ -48,7 +48,7 @@ let
scFormat = "ScJson"; }
{
scKind = "FileSK";
scName = "/var/lib/cardano-node/logs/node.json";
scName = "/var/lib/cardano-node/logs/${name}.json";
scFormat = "ScJson";
scRotation = {
rpLogLimitBytes = 300000000;
Expand Down Expand Up @@ -110,19 +110,45 @@ in reportDeployment (rec {
explorer = {
imports = [
pkgs.cardano-ops.roles.tx-generator
({ config, ...}: {
services.cardano-submit-api = {
environment = pkgs.globals.environmentConfig;
socketPath = config.services.cardano-node.socketPath;
};
systemd.services.cardano-db-sync = {
wantedBy = [ "multi-user.target" ];
requires = [ "postgresql.service" ];
path = [ pkgs.netcat ];
preStart = ''
'';
serviceConfig = {
ExecStartPre = pkgs.lib.mkForce
("+" + pkgs.writeScript "cardano-db-sync-prestart" ''
#!/bin/sh
set -xe
chmod -R g+w /var/lib/cardano-node
for x in {1..10}
do nc -z localhost ${toString config.services.cardano-db-sync.postgres.port} && break
echo loop $x: waiting for postgresql 2 sec...
sleep 2; done
'');
};
};
})
];
services.cardano-graphql.enable = pkgs.lib.mkForce false;
services.graphql-engine.enable = pkgs.lib.mkForce false;
services.cardano-db-sync = {
logConfig =
pkgs.iohkNix.cardanoLib.defaultExplorerLogConfig
// benchmarkingLogConfig;
// benchmarkingLogConfig "db-sync";
};
};
coreNodes = map (n : n // {
services.cardano-node.nodeConfig =
pkgs.globals.environmentConfig.nodeConfig
// benchmarkingLogConfig
// benchmarkingLogConfig "node"
// {
PBftSignatureThreshold =
(1.0 / __length benchmarkingTopology.coreNodes) * 1.5;
Expand Down

0 comments on commit 225724a

Please sign in to comment.