From f90a594207f015b0b0645eeb885bbeed3154e2ed Mon Sep 17 00:00:00 2001 From: Michael Bishop Date: Thu, 7 Oct 2021 23:02:18 -0300 Subject: [PATCH] the latest changes --- bisect_cycle | 13 +++++++++++++ fail.json | 24 ++++++++++++++++++++++++ membench.nix | 20 +++++++++++++++----- membench_params.json | 2 +- pass.json | 24 ++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 6 deletions(-) create mode 100755 bisect_cycle create mode 100644 fail.json create mode 100644 pass.json diff --git a/bisect_cycle b/bisect_cycle new file mode 100755 index 00000000000..13330ee445d --- /dev/null +++ b/bisect_cycle @@ -0,0 +1,13 @@ +#!/bin/sh + +lastResult=$(jq < result/refined.json .failed) + +if [ x$lastResult = xfalse ]; then + nix-store -r $(readlink ./result) --add-root pass --indirect + cp -f result/refined.json pass.json +else + nix-store -r $(readlink ./result) --add-root fail --indirect + cp -f result/refined.json fail.json +fi + +cat fail.json pass.json diff --git a/fail.json b/fail.json new file mode 100644 index 00000000000..cf58bb668ec --- /dev/null +++ b/fail.json @@ -0,0 +1,24 @@ +{ + "RSS": { + "min": 69.51953125, + "avg": 1283.193758150149, + "max": 5738.69140625 + }, + "Heap": { + "min": 42, + "avg": 1255.9150521609538, + "max": 5711 + }, + "CentiCpuMax": 74626, + "CentiMutMax": 67012, + "CentiGC": 7586, + "CentiBlkIO": 0, + "flags": "+RTS -RTS", + "chain": { + "startSlot": 38037613, + "stopFile": 1800 + }, + "totaltime": 1350, + "failed": true, + "memSize": 12500 +} diff --git a/membench.nix b/membench.nix index c4336eab9f0..32297a2f214 100644 --- a/membench.nix +++ b/membench.nix @@ -1,13 +1,16 @@ -{ runCommand, cardano-node, jq, snapshot, vmTools, strace, util-linux, e2fsprogs, gnugrep }: +{ runCommand, cardano-node, jq, snapshot, vmTools, strace, util-linux, e2fsprogs, gnugrep, procps, time }: let params = builtins.fromJSON (builtins.readFile ./membench_params.json); topology = { Producers = []; }; flags = params.rtsFlags; topologyPath = builtins.toFile "topology.json" (builtins.toJSON topology); + passMem = (builtins.fromJSON (builtins.readFile ./pass.json)).memSize; + failMem = (builtins.fromJSON (builtins.readFile ./fail.json)).memSize; + avgMem = (passMem+failMem) / 2; membench = vmTools.runInLinuxVM (runCommand "membench" { - memSize = params.memSize; # mb - buildInputs = [ cardano-node jq strace util-linux e2fsprogs ]; + memSize = if (params.memSize == "auto") then avgMem else params.memSize; + buildInputs = [ cardano-node jq strace util-linux e2fsprogs procps time ]; succeedOnFailure = true; preVM = '' truncate disk.img --size 2G @@ -31,7 +34,11 @@ let mkdir -pv $out/nix-support echo 42 > $out/nix-support/failed + # never overcommit + echo 2 > /proc/sys/vm/overcommit_memory + pwd + free -m mkfs.ext4 /dev/vda mkdir /state mount /dev/vda /state @@ -57,10 +64,12 @@ let | .defaultScribes = .defaultScribes + [ [ "FileSK", "log.json" ] ] ' ${./configuration/cardano/mainnet-config.json} > config.json cp -v ${./configuration/cardano}/*-genesis.json . - cardano-node ${flags} run --database-path /state/chain/ --config config.json --topology ${topologyPath} --shutdown-on-slot-synced 2000 + command time -f %M -o $out/highwater cardano-node ${flags} run --database-path /state/chain/ --config config.json --topology ${topologyPath} --shutdown-on-slot-synced 2000 #sleep 600 #kill -int $! pwd + df -h + free -m ls -ltrh /state/chain/ledger/ mv -vi log*json config.json $out/ mv /state/chain $out/ @@ -76,6 +85,7 @@ runCommand "membench-post-process" { # so the node wont get GC'd, and you could confirm the source it came from ln -s ${cardano-node}/bin/cardano-node . totaltime=$({ head -n1 log.json ; tail -n1 log.json;} | jq --slurp 'def katip_timestamp_to_iso8601: .[:-4] + "Z" | fromdateiso8601; map(.at | katip_timestamp_to_iso8601) | .[1] - .[0]') + highwater=$(cat ${membench}/highwater) if [ -f ${membench}/nix-support/failed ]; then export FAILED=true @@ -85,5 +95,5 @@ runCommand "membench-post-process" { export FAILED=false fi - jq --slurp < summary.json 'def minavgmax: length as $len | { min: (min/1024/1024), avg: ((add / $len)/1024/1024), max: (max/1024/1024) }; map(select(.ns[0] == "cardano.node.resources") | .data) | { RSS: map(.RSS) | minavgmax, Heap: map(.Heap) | minavgmax, CentiCpuMax: map(.CentiCpu) | max, CentiMutMax: map(.CentiMut) | max, CentiGC: map(.CentiGC) | max, CentiBlkIO: map(.CentiBlkIO) | max, flags: "${flags}", chain: { startSlot: ${toString snapshot.snapshotSlot}, stopFile: ${toString snapshot.finalEpoch} }, totaltime:'$totaltime', failed:'$FAILED', memSize: ${toString membench.memSize} }' > refined.json + jq --slurp < summary.json 'def minavgmax: length as $len | { min: (min/1024/1024), avg: ((add / $len)/1024/1024), max: (max/1024/1024) }; map(select(.ns[0] == "cardano.node.resources") | .data) | { RSS: map(.RSS) | minavgmax, Heap: map(.Heap) | minavgmax, CentiCpuMax: map(.CentiCpu) | max, CentiMutMax: map(.CentiMut) | max, CentiGC: map(.CentiGC) | max, CentiBlkIO: map(.CentiBlkIO) | max, flags: "${flags}", chain: { startSlot: ${toString snapshot.snapshotSlot}, stopFile: ${toString snapshot.finalEpoch} }, totaltime:'$totaltime', failed:'$FAILED', memSize: ${toString membench.memSize}, highwaterMB: '$highwater'/1024 }' > refined.json '' diff --git a/membench_params.json b/membench_params.json index 0eebefeaec2..e4253162f7f 100644 --- a/membench_params.json +++ b/membench_params.json @@ -1,5 +1,5 @@ { - "memSize":7488, + "memSize":"auto", "snapshotSlot":38037613, "finalImmFile":1800, "rtsFlags":"+RTS -RTS" diff --git a/pass.json b/pass.json new file mode 100644 index 00000000000..76ede5074b8 --- /dev/null +++ b/pass.json @@ -0,0 +1,24 @@ +{ + "RSS": { + "min": 71.37109375, + "avg": 2399.037989327347, + "max": 6744.19140625 + }, + "Heap": { + "min": 44, + "avg": 2371.906112161311, + "max": 6717 + }, + "CentiCpuMax": 104132, + "CentiMutMax": 92218, + "CentiGC": 11959, + "CentiBlkIO": 0, + "flags": "+RTS -RTS", + "chain": { + "startSlot": 38037613, + "stopFile": 1800 + }, + "totaltime": 1603, + "failed": false, + "memSize": 16000 +}