[go: up one dir, main page]

Shell: improve validation profiling

What

Improve the profiling of block validator.

Why

Profiling for the preapplication of block were missing.

How

Add some profiling probes for preapplication of blocks and add some probes for other functions done either at validation or application of blocks.

Manually testing the MR

Run a profiled sandboxed node, activate alpha, and bake for 2 blocks:

In the block_validator_profiling.txt you should got something like

2024-10-03T09:45:50.033-00:00
BLLFzyUthwaDTuivyPWmtnqXM7YvbwPiJBMcRKAoTuc4o9f5vD9 ............................ 1        236857.658ms   1% +19s585.131ms
  checks ....................................................................... 0                        
    chain_liveness ............................................................. 1            0.001ms  84%
    merkle_root ................................................................ 1            0.016ms  99%
  read_predecessor ............................................................. 1            0.003ms  97% +0.070ms
  compute_live_blocks .......................................................... 1            0.003ms  97% +0.079ms
  check_liveness ............................................................... 1            0.003ms 105% +0.083ms
  validate_block ............................................................... 1            0.882ms 101% +0.226ms
    parse_operations ........................................................... 1            0.012ms 110% +0.088ms
    begin_validation ........................................................... 1            0.433ms 101% +0.102ms
      check_signature_ed25519 .................................................. 1            0.081ms 100%
      load_predecessor_cache ................................................... 1            0.070ms 101% +0.000ms
    validate_operations ........................................................ 1            0.334ms 100% +0.535ms
      operation_list(0) ........................................................ 1            0.328ms 100% +0.001ms
        operation(onfq1ZGMxFAnGBfovWkoamCo9Z7925yiVq2C9vUZ5Ca7UhU37Fd) ......... 1            0.068ms 102% +0.007ms
          check_signature_ed25519 .............................................. 1            0.056ms 100%
        operation(opDdpjbERx3haEEknxnw65eu3Gr8wKRxWvHh93XXE5NkQoWLtNR) ......... 1            0.057ms 102% +0.080ms
          check_signature_ed25519 .............................................. 1            0.054ms 100%
        operation(opE3MdMa9dXhxP3L6rSMGWb6sK1i5RxL5MH2VJr4Hfi9HgzrrBi) ......... 1            0.058ms 101% +0.142ms
          check_signature_ed25519 .............................................. 1            0.056ms 100%
        operation(oosPgLCrhB24YxwKLRY2gn4GgqNyZXsW5v5yBjMb5FqcRgPnxZp) ......... 1            0.058ms  99% +0.205ms
          check_signature_ed25519 .............................................. 1            0.056ms 100%
        operation(opDcgoQY8ZuK5pgoEkdCNnfnofAkiRJnS3sVv5DpFHUEedcK1uX) ......... 1            0.060ms 100% +0.267ms
          check_signature_ed25519 .............................................. 1            0.057ms 101%
      operation_list(1) ........................................................ 1            0.001ms   0% +0.330ms
      operation_list(2) ........................................................ 1                         +0.333ms
      operation_list(3) ........................................................ 1            0.001ms   0% +0.333ms
    finalize_validation ........................................................ 1            0.009ms 100% +0.870ms
  get_predecessor_metadata ..................................................... 1            0.001ms 105% +1.235ms
  apply_block .................................................................. 1            0.653ms 101% +1.317ms
  commit_block ................................................................. 1            0.200ms 101% +2.004ms
  compute_live_blocks .......................................................... 1            0.003ms 130% +3m56s853.959ms
  get_block_metadata ........................................................... 1            0.001ms 105% +3m56s853.972ms
  resulting_context_hash ....................................................... 1            0.004ms  99% +3m56s853.973ms
  preapply_block ............................................................... 1            1.598ms 100% +3m56s854.212ms
    begin_validation ........................................................... 1            0.448ms 101% +0.073ms
      load_predecessor_cache ................................................... 1            0.056ms 102% +0.000ms
    begin_application .......................................................... 1            0.447ms 101% +0.522ms
      load_predecessor_cache ................................................... 1            0.019ms 100% +0.000ms
    validate_operation ......................................................... 1            0.075ms 100% +0.979ms
      check_signature_ed25519 .................................................. 1            0.061ms 102%
    apply_operations ........................................................... 1            0.003ms 105% +1.055ms
    validate_operation ......................................................... 1            0.045ms 100% +1.066ms
      check_signature_ed25519 .................................................. 1            0.042ms  98%
    apply_operations ........................................................... 1            0.001ms 105% +1.111ms
    validate_operation ......................................................... 1            0.043ms 100% +1.114ms
      check_signature_ed25519 .................................................. 1            0.042ms  98%
    apply_operations ........................................................... 1                         +1.158ms
    validate_operation ......................................................... 1            0.044ms  98% +1.160ms
      check_signature_ed25519 .................................................. 1            0.042ms  98%
    apply_operations ........................................................... 1                         +1.204ms
    validate_operation ......................................................... 1            0.043ms 101% +1.206ms
      check_signature_ed25519 .................................................. 1            0.042ms  98%
    apply_operations ........................................................... 1            0.001ms   0% +1.249ms
    finalize_application ....................................................... 1            0.230ms  98% +1.263ms
    compute_metadata ........................................................... 1            0.028ms 101% +1.566ms

We can observed that the previous block is only validated (preapplied block are cached) and the new preapplied block is now profiled

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.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Albin Coquereau

Merge request reports

Loading