GossipSub: Add PPX profiler
What
Adding PPX profiler to the GossipSub worker.
Why
We want to evaluate the performance of the GossipSub P2P layer.
How
By adding the PPX profiler in the gossipsub library and then using it in the DAL node as well (for initialisation and block reset).
Manually testing the MR
-
Manual (
ghostnet) testing:
TEZOS_PPX_PROFILER=profiling make
PROFILING=Debug PROFILING_BACKEND=txt ./octez-node run --data-dir ~/.tezos-node-ghostnet --rpc-addr 127.0.0.1:18733
./octez-dal-node config init --endpoint http://127.0.0.1:18733 --attester-profiles=<baker-key>
PROFILING=Debug PROFILING_BACKEND=txt ./octez-dal-node run
And I got the following results in ~/.tezos-dal-node/gossipsub_profiling.txt:
...
2025-06-16T15:24:16.492-00:00
BLMexkADmqFiPNVrS3MyKPN2MbtwTbj94e2TPiFYzHW3ANBkCLx ............................ 1 3653.516ms 6%
apply_event .................................................................. 69 166.049ms 98%
Check_unknown_messages ..................................................... 4 35.518ms 100%
Heartbeat .................................................................. 4 3.238ms 93%
P2P_input .................................................................. 61 127.116ms 98%
In_message ............................................................... 61 127.017ms 98%
Message_with_header .................................................... 61 126.788ms 98%
2025-06-16T15:24:20.146-00:00
BLaYXuqq3WNGXDbubqpsxN5X6FzAGSgeVD315L1bLi9rDFztMSJ ............................ 1 4840.368ms 9%
apply_event .................................................................. 326 295.308ms 99%
Check_unknown_messages ..................................................... 5 0.037ms 97%
Heartbeat .................................................................. 5 15.221ms 94%
P2P_input .................................................................. 316 278.813ms 100%
In_message ............................................................... 316 277.911ms 100%
Message_with_header .................................................... 155 272.943ms 100%
Ping ................................................................... 1 0.002ms 53%
Prune .................................................................. 160 3.658ms 84%
2025-06-16T15:24:24.986-00:00
BLPmZVbPyUqZrwNx6wWLiZcwZ49ybRYoEcLaUxo34FE9vGj6eHQ ............................ 1 3129.698ms 6%
...
- TEZT-CLOUD (DAL scenario)
Command used:
dune exec tezt/tests/cloud/main.exe -- DAL --stake 1,1 --producers 32 --log-file ghost_32p_prof --proxy --proxy-localhost --network ghostnet --website --monitoring --prometheus --prometheus-export --grafana --tezt-cloud ghost-32p-prof --dockerfile-alias dal --keep-temp --process-monitoring -v --ppx-profiling
PRODUCER result:
...
2025-06-16T16:02:50.338-00:00
BMEPiGFwUGzq4tHeUJhuMd2EmgeXYVEoFxyjakxkFL6jejotj7s ............................ 1 4218.467ms 52%
apply_event .................................................................. 236 12.860ms 105%
Check_unknown_messages ..................................................... 3 0.007ms 116%
Heartbeat .................................................................. 3 1.923ms 100%
P2P_input .................................................................. 230 9.908ms 104%
In_message ............................................................... 230 8.848ms 103%
Prune .................................................................. 230 7.344ms 101%
2025-06-16T16:02:54.557-00:00
BMSmGaHuR7qBVVzj28mpfhoMMfr8TxSNKNCYPe6EzfT5yUuZy1h ............................ 1 3871.280ms 58%
apply_event .................................................................. 519 8.154ms 101%
App_input .................................................................. 512 4.374ms 99%
Check_unknown_messages ..................................................... 2 0.005ms 100%
Heartbeat .................................................................. 2 1.825ms 100%
P2P_input .................................................................. 3 0.059ms 99%
In_message ............................................................... 3 0.040ms 103%
Ping ................................................................... 3 0.006ms 118%
...
In the /baker-dal-node-0 folder I got the following gossipsub_profiling.txt:
...
2025-06-16T16:05:15.746-00:00
BM9vfNMVbztx1MEQHn2sxEfDaVYKSZj7hFHSKbs4R1AJ8PXGVN8 ............................ 1 3524.149ms 1%
apply_event .................................................................. 7 0.715ms 102%
Check_unknown_messages ..................................................... 3 0.007ms 120%
Heartbeat .................................................................. 3 0.629ms 100%
P2P_input .................................................................. 1 0.014ms 100%
In_message ............................................................... 1 0.011ms 92%
Ping ................................................................... 1 0.001ms 105%
2025-06-16T16:05:19.270-00:00
BLEwpMXL1eNptCFYmJWDEFaMG9Y4ecNRVgVLhtnFwcdRq6RDef7 ............................ 1 4130.555ms 1%
apply_event .................................................................. 9 1.099ms 102%
Check_unknown_messages ..................................................... 4 0.008ms 96%
Heartbeat .................................................................. 4 1.013ms 100%
P2P_input .................................................................. 1 0.021ms 101%
In_message ............................................................... 1 0.015ms 102%
Ping ................................................................... 1 0.001ms 105%
...
(I did not see any Message_with_header in the profiling outputs, not sure if this is expected or not)
The commitments didn't look too convincing here:

Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Eugen Zalinescu