ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.42k stars 20.07k forks source link

[Geth Clique] Obtain average time to execute a block #22708

Closed dsaingre closed 3 years ago

dsaingre commented 3 years ago

Hi, My goal is to be able to get access to the average time taken by a private PoA (Clique) geth node to execute all transactions in a block. I was wondering what could be the best metric for this matter? I've activated the metric server and can have access to metrics like chain/head/block (number of highest block) and txpool/pending (number of pending transactions) but most metrics stay at 0.

For instance: chain/inserts, chain/validation, chain/execution and chain/write timers (that seems to be what I am looking for) stay at a value of 0. If fact, most of my metrics stays at 0 (see provided file: metrics.txt ).

Is this normal to have so many 0s metrics? Is there any metrics to get access to average block execution time?

(P.S: I chose the question issue type as I'm not sure if this is a bug or just a misusage on my side).

Network description

Only one PoA Eth. Transactions are generated by a python script. Transactions are indeed processed and included in blocs. Everything seems to work.

Geth command

(executed in a docker environment)

exec geth \
  --datadir /root \
  --config .config.toml \
  --allow-insecure-unlock \
  --nousb \
  --verbosity $ETH_VERBOSITY \
  --gcmode=archive \
  --mine \
  --miner.threads 1 \
  --unlock $ETH_ADDRESS \
  --password /tmp/eth_pass \
  --metrics --metrics.expensive \
  --metrics.addr '0.0.0.0' \
  --metrics.influxdb \
  --metrics.influxdb.endpoint "http://influxdb:8086" \
  --metrics.influxdb.database "db0" \
  --metrics.influxdb.username "admin" \
  --metrics.influxdb.password "admin"

Geth Version

Geth
Version: 1.10.3-unstable
Git Commit: 9c653ff6625df1ff0f6c6612958b2a1da0021e40
Git Commit Date: 20210409
Architecture: amd64
Go Version: go1.16.3
Operating System: linux
GOPATH=
GOROOT=go
karalabe commented 3 years ago

Most metrics revolve around networking and block processing. Since you have a single node, there's no networking, and since you are mining your own blocks, there's no block import :D We don't have metrics in the miner, not something too relevant in the grand scheme of things.

dsaingre commented 3 years ago

OK I get it, I though that miners too would use block processing related metrics. I guess I just need to have a second, non mining node to get access to those metrics. Thanks for the prompt answer!