polkadot
polkadot copied to clipboard
`approval-voting`: implement parallel processing of signature checks.
I've been experimenting with using a thread pool to handle VRF signature checks which appear to be most expensive operation that we are doing in approval voting. After running some benchmarks I got these results on AMD EPYC 7601 32-Core Processor:
check/no-pool time: [208.94 ms 209.10 ms 209.31 ms]
thrpt: [4.7777 Kelem/s 4.7825 Kelem/s 4.7861 Kelem/s]
check/pool_size_1 time: [267.76 ms 271.14 ms 276.34 ms]
thrpt: [3.6187 Kelem/s 3.6881 Kelem/s 3.7346 Kelem/s]
check/pool_size_2 time: [162.28 ms 163.93 ms 165.20 ms]
thrpt: [6.0532 Kelem/s 6.1001 Kelem/s 6.1621 Kelem/s]
check/pool_size_4 time: [111.01 ms 112.44 ms 113.99 ms]
thrpt: [8.7728 Kelem/s 8.8934 Kelem/s 9.0084 Kelem/s]
check/pool_size_8 time: [84.792 ms 85.514 ms 85.961 ms]
thrpt: [11.633 Kelem/s 11.694 Kelem/s 11.794 Kelem/s]
I expect this change to work very well with https://github.com/paritytech/polkadot/issues/6608 because it will allow us to multiplex all the CPU intensive work of the subsystem to multiple CPU cores, improving our current single threaded design.
Important note: The number of blocking threads used needs to be bounded and we would also need an upper limit at which we add backpressure.