Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Comparative Analysis: debug_executionWitness Latency

This document presents the results of measurements conducted to analyze the latency improvements of the debug_executionWitness RPC method across different configurations.

note

All measurements were obtained using an RPC node running on the same machine, avoiding network-related latency.

Each configuration was measured over a different block range at different points in time. While block characteristics vary, the sample sizes are large enough to provide meaningful comparisons.

Configurations

  • Pre-Serialized (added in PR #5956): Execution witnesses are generated during payload execution, converted to RpcExecutionWitness, and stored as pre-serialized JSON bytes in the database. On read, the bytes are parsed directly to serde_json::Value without any additional traversal or serialization.
  • Pre-Generated: Execution witnesses are generated during payload execution and stored in the database (but require encode_subtrie() traversal and serialization on each read).
  • On-Demand: Execution witnesses are generated when calling debug_executionWitness.

Measurements

MetricPre-SerializedPre-GeneratedOn-Demand
Total Blocks Analyzed199176176
Min Time6 ms3 ms56 ms
Max Time268 ms255 ms521 ms
Average Time94 ms131 ms242 ms
Median Time91 ms130 ms224 ms
Block Range24335714 – 2433591224191178 – 2419135324190748 – 24190923

Conclusions

Pre-Serialized vs On-Demand

The average latency drops from 242 ms (on-demand) to 94 ms (pre-serialized), representing an improvement of approximately 61%. Median latency shows a similar improvement, decreasing from 224 ms to 91 ms.

Pre-Serialized vs Pre-Generated

The average latency drops from 131 ms (pre-generated) to 94 ms (pre-serialized), representing an additional improvement of approximately 28%. This improvement comes from eliminating the encode_subtrie() depth-first traversal that was previously performed on every read to convert ExecutionWitness to RpcExecutionWitness.

Pre-Generated vs On-Demand

The average latency drops from 242 ms (on-demand) to 131 ms (pre-generated), representing an improvement of approximately 46%. Median latency shows a similar improvement, decreasing from 224 ms to 130 ms.

Overall

Pre-serialized execution witnesses exhibit the tightest latency distribution. On-demand requests frequently experience high-latency spikes due to witness generation at request time. Pre-generating and pre-serializing execution witnesses during payload execution effectively eliminates most of these spikes and results in more predictable response times.

How These Measurements Were Done

These metrics were obtained from an ethrex node synced to the Ethereum mainnet.

Each configuration was measured over a contiguous range of blocks, and latency was recorded for each request.

How to Get Metrics

  1. Ensure the node is synced.
    Use the --precompute-witnesses flag to generate and store execution witnesses upon receiving a newPayload message.

  2. Enable debug logging for ethrex-replay by editing src/main.rs:21:

    add_directive(Directive::from(tracing::Level::DEBUG))
    
  3. Run ethrex-replay using the --endless flag:

    cargo run -r -- blocks --endless --rpc-url [RPC_URL]
    
  4. Filter logs to capture execution witness latency:

    cargo run -r -- blocks --endless --rpc-url [RPC_URL] 2>&1 | grep --line-buffered 'Got execution witness for block' | tee execution_witness_times.txt
    
  5. Post-process the captured measurements to compute min, max, average, and median latencies.

Appendix

Full Measurement Data

Pre-Serialized

Total blocks analyzed: 199

Block NumberTime (ms)
24335714110
2433571587
2433571697
2433571771
2433571862
24335719105
2433572062
2433572172
2433572233
2433572398
2433572495
24335725139
2433572661
2433572788
2433572881
2433572997
2433573073
24335731126
24335732112
24335733120
2433573466
24335735106
2433573687
2433573797
24335738161
2433573927
24335740114
2433574185
24335742133
2433574336
24335744164
24335745129
2433574644
2433574746
2433574836
24335749141
24335750145
24335751119
24335752112
2433575378
2433575482
24335755142
2433575621
24335757131
2433575899
2433575977
24335760107
2433576197
24335762132
2433576378
2433576483
2433576548
24335766131
2433576783
2433576860
2433576959
24335770147
2433577175
2433577270
24335773146
2433577478
24335775104
2433577694
2433577797
24335778106
2433577991
2433578057
2433578160
24335782186
24335783122
2433578453
24335785143
2433578679
2433578783
24335788100
2433578968
24335790114
2433579164
24335792102
24335793132
2433579467
24335795111
2433579673
2433579796
2433579877
2433579938
24335800171
24335801140
2433580278
24335803105
2433580475
24335805107
2433580684
2433580778
2433580839
24335809107
24335810108
24335811146
2433581282
24335813118
2433581487
2433581586
2433581682
2433581797
24335818106
2433581931
24335820158
2433582186
2433582271
2433582377
2433582473
24335825113
2433582641
24335827137
2433582892
2433582981
24335830100
24335831119
2433583280
2433583385
243358346
2433583545
24335836171
24335837134
24335838268
2433583979
24335840169
24335841158
2433584223
24335843164
2433584497
24335845104
2433584693
2433584719
24335848119
2433584978
24335850121
2433585179
24335852138
2433585374
2433585492
24335855106
2433585682
2433585783
2433585874
2433585977
2433586041
2433586191
2433586217
2433586391
24335864118
24335865109
2433586685
2433586784
2433586874
2433586973
2433587090
24335871102
2433587285
24335873109
2433587442
2433587572
24335876130
2433587767
24335878109
24335879102
2433588075
24335881120
2433588274
2433588385
2433588482
2433588594
2433588695
2433588757
24335888108
2433588941
24335890131
24335891156
24335892105
24335893119
2433589491
2433589564
24335896139
24335897144
2433589886
2433589940
2433590052
24335901180
24335902121
2433590342
2433590466
2433590570
2433590692
24335907104
2433590882
2433590985
2433591078
2433591197
2433591286

Pre-Generated

Total blocks analyzed: 176

Block NumberTime (ms)
24191178103
24191179156
2419118061
24191181127
24191182103
24191183126
24191184132
24191185106
2419118697
24191187136
2419118864
24191189212
2419119050
24191191167
24191192132
24191193131
2419119497
24191195124
2419119699
2419119799
24191198113
24191199104
24191200113
24191201135
24191202157
24191203120
24191204120
24191205131
24191206186
24191207116
24191208108
2419120944
24191210181
24191211119
24191212114
24191213111
24191214135
24191215167
2419121661
24191217155
24191218131
24191219143
241912204
24191221139
2419122266
24191223246
24191224194
24191225111
24191226153
2419122730
24191228136
24191229152
24191230112
24191231124
24191232123
24191233116
2419123471
24191235187
2419123689
24191237226
24191238145
24191239130
24191240120
24191241189
241912423
24191243197
24191244117
24191245142
24191246144
24191247143
24191248166
24191249106
2419125035
24191251236
24191252141
24191253121
24191254109
24191255165
24191256125
24191257128
24191258130
2419125989
24191260126
24191261124
24191262118
24191263147
24191264108
24191265136
24191266159
2419126798
24191268157
2419126998
24191270100
24191271145
24191272119
24191273150
24191274119
24191275107
24191276127
2419127741
24191278236
24191279147
2419128086
24191281205
24191282117
24191283172
24191284122
2419128539
24191286177
24191287143
24191288118
24191289115
24191290146
24191291115
24191292173
24191293143
24191294118
2419129586
24191296159
24191297133
24191298154
24191299132
24191300118
24191301141
24191302111
24191303179
2419130486
2419130537
24191306171
24191307255
24191308211
24191309138
24191310133
24191311173
24191312153
24191313109
24191314135
24191315181
24191316128
2419131785
24191318126
24191319121
2419132083
24191321214
24191322197
24191323180
24191324141
24191325160
24191326128
2419132786
24191328181
24191329158
2419133084
24191331178
24191332134
24191333117
24191334128
24191335152
24191336139
24191337136
24191338170
24191339131
24191340136
24191341181
24191342126
24191343123
24191344168
2419134568
2419134642
24191347249
24191348172
24191349178
24191350127
24191351150
24191352138
2419135332

On-Demand

Total blocks analyzed: 176

Block NumberTime (ms)
24190748228
24190749286
24190750308
24190751290
24190752272
24190753334
24190754208
24190755189
24190756118
24190757367
24190758128
24190759411
24190760226
24190761179
24190762451
24190763489
24190764350
24190765254
24190766304
24190767220
24190768154
24190769521
2419077056
24190771311
24190772436
24190773226
24190774235
24190775216
24190776222
24190777259
24190778165
24190779232
24190780197
24190781206
24190782424
24190783209
24190784232
24190785213
24190786262
24190787190
24190788233
24190789206
24190790178
24190791277
24190792167
24190793329
24190794408
24190795368
24190796160
24190797221
24190798208
24190799296
24190800256
24190801222
24190802131
24190803318
24190804270
24190805179
24190806220
24190807201
24190808205
24190809279
24190810252
24190811140
24190812378
24190813221
24190814325
24190815241
24190816186
24190817193
24190818174
24190819327
24190820210
24190821208
24190822195
24190823244
2419082480
24190825128
24190826363
24190827231
24190828286
24190829368
24190830198
24190831293
24190832275
24190833309
24190834219
2419083591
24190836319
24190837269
24190838292
24190839193
24190840203
24190841188
24190842124
24190843305
24190844236
24190845179
24190846148
24190847280
24190848208
24190849265
24190850197
24190851225
24190852266
24190853181
24190854225
24190855256
24190856216
24190857374
24190858225
24190859296
24190860175
24190861171
24190862406
24190863236
24190864196
24190865184
24190866265
24190867172
24190868123
24190869470
24190870184
24190871244
24190872172
2419087399
24190874387
24190875209
24190876207
24190877133
24190878161
24190879223
24190880217
24190881234
24190882261
24190883203
24190884234
24190885263
24190886193
24190887211
24190888168
24190889344
2419089088
24190891399
24190892191
24190893244
24190894140
24190895195
24190896275
24190897121
24190898462
24190899291
24190900192
24190901183
24190902268
24190903294
24190904277
24190905271
24190906190
24190907222
24190908109
24190909335
24190910252
2419091191
24190912143
24190913414
2419091473
24190915457
2419091693
24190917148
24190918479
24190919156
2419092080
24190921421
24190922411
24190923220