input-output-hk / mithril

Stake-based threshold multi-signatures protocol
https://mithril.network
Apache License 2.0
115 stars 36 forks source link

Add Block Range Merkle Map cache pool in Cardano Transactions prover #1713

Closed jpraynaud closed 1 month ago

jpraynaud commented 1 month ago

Content

This PR includes the implementation of a cache pool of the Block Range Merkle Maps to improve the Cardano transactions prover performances:

Benchmarks

Image

Total Requests Concurrency Transactions / Request Pool (x1): Request/s Pool (x5): Request/s Pool (x10): Request/s Pool (x25): Request/s Pool (x50): Request/s
1000 100 1 39 156 213 229 237
1000 100 2 28 110 152 169 171
1000 100 3 21 83 116 129 128
1000 100 4 18 70 96 104 105
1000 100 5 15 59 82 87 86
1000 100 6 0 0 0 0 0
1000 100 7 0 0 0 0 0
1000 100 8 0 0 0 0 0
1000 100 9 0 0 0 0 0
1000 100 10 0 0 0 0 0

Running on Linux / 8 cores / 64 GB RAM / 2 TB SSD

Memory impact

~240MB / new pool resource

Pooled Resources Memory / GB
1 0
5 1
10 3
25 6
50 13
100 25

Conclusions

The performances are considerably improved with the implementation of resource pooling for Block Ranges Merkle maps. We recommend to use a size of the pool with a value between 25 and 50 which gives good trade-off between memory usage and performances gain. This value is subject to change as we suspect that other factors are limiting the throughput which drastically drops with more than 5 transactions to certifiy per request.

Pre-submit checklist

Issue(s)

Closes #1698

github-actions[bot] commented 1 month ago

Test Results

    3 files  ±0     43 suites  ±0   8m 29s :stopwatch: -1s 1 003 tests +9  1 003 :white_check_mark: +9  0 :zzz: ±0  0 :x: ±0  1 101 runs  +9  1 101 :white_check_mark: +9  0 :zzz: ±0  0 :x: ±0 

Results for commit be085ae0. ± Comparison against base commit 37d0390a.

:recycle: This comment has been updated with latest results.