Skip to content

[perf] decrease CPU usage due to disabling tracing in several places#437

Merged
ikatson merged 13 commits intomainfrom
tracing-decrease
Jun 27, 2025
Merged

[perf] decrease CPU usage due to disabling tracing in several places#437
ikatson merged 13 commits intomainfrom
tracing-decrease

Conversation

@ikatson
Copy link
Owner

@ikatson ikatson commented Jun 26, 2025

Profiling in llinux perf showed a couple hotspots in tracing crate, which boiled down to a couple things:

  1. error_span!() was used everywhere, which is very convenient - it makes all log messages contain useful metadata, e.g. peer's address would be printed in every log line printed from the peer's task. However this causes overhead even when there's no logging at all seemingly. So I changed them all to lower level and manually propagated needed context to info!, warn! and error! log messages.
  2. the order of filters seems to matter for performance. The (99.9% of the time) useless HTTP log layer was causing tracing overhead simply because the order of filters was suboptimal.

@ikatson ikatson changed the title [perf] big perf improvements due to disabling tracing in several places [perf] decrease CPU usage due to disabling tracing in several places Jun 27, 2025
@ikatson ikatson merged commit 7e889db into main Jun 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant