This fixes https://github.com/bitcoin-core/libmultiprocess/issues/215 on Core’s side. It depends on https://github.com/bitcoin-core/libmultiprocess/pull/220 being merged upstream, and a PR to update our subtree. I’ve included a subtree merge from my repo here for now, but will rebase on top of the merge from upstream once it’s in. Edit: Rebased on top of #33518.
For context: before https://github.com/bitcoin-core/libmultiprocess/pull/220, libmultiprocess serializesd every log message parameter, even if that message was ultimately going to be discarded. The upstream PR accomplished 2 main things:
- Creates logging categories, similar to Core’s
- Using macros, avoids serializing parameters for disabled log levels.
That allowed the expensive serialization to be skipped, but the default log level is Trace. This PR updates our usage of libmultiprocess options to honor our log categories and levels.
Because of the substantial unnecessary overhead (see the flamegraphs. Logging accounts for 50% of my application’s cpu time, and nearly 10% of bitcoin-node’s, both of which go to ~0% once fixed), it’d be a shame to ship the first multiprocess binaries without this fixed. So I propose that we also backport this (and the required libmultiprocess subtree merge) to v30. Sorry about the timing :(
Edit: Didn’t make it for v30, but it would still make sense to backport for a v30.1.