Description
Looking at the logs of RBH<>WBH complex relay (4 nodes connected, 4 messages race relays, 2 on-demand header relays, 2 on-demand parachain relays, version guards, metrics), we're doing ~30 RPC requests per second. We don't care much about relay performance, but it looks too much :) Most of requests are method=chain_getBlockHash
and method=chain_getHeader
. That's because every relay (and we have 8 relays running) are polling nodes for new headers. We may have some cache for these results.
Ideally we'll need to traitify the whole Substrate Client
. This would give us possibility to use it in tests => allow to test client-specific code. And when we talk about this issue, we may have some CachedClient
that nests the regular Client
and maintains some results cache for some (or all) calls.