avoid timeouts to improve cpu performance#213
Merged
Merged
Conversation
domcyrus
requested changes
Mar 30, 2026
domcyrus
left a comment
Owner
There was a problem hiding this comment.
@deepakpjose Thanks a lot for this change. I've tested it a bit and the CPU improvement looks good to me. One thing to maybe fix: the fetch_add(1, ...) on the Full error path undercounts dropped packets since it's now dropping entire batches, we probably should use the batch length instead.
domcyrus
added a commit
that referenced
this pull request
Apr 9, 2026
- Windows restricted token sandbox (#206) - macOS Seatbelt sandboxing, later tightened (#196, #203) - Linux sandbox hardening: drop capabilities and clear ambient set (#208) - UI: process privilege shown in security section (#197) - Filter: exact port matching and regex support (#195) - VLAN support in PKTAP/SLL parsers and L3 extraction (#202, #199) - IGMP protocol parsing (#209) - Process name for wildcard /proc/net entries (#218) - CPU efficiency improvements in sort/snapshot/rate/timeout paths (#213, #220, #212, #222) — thanks @deepakpjose - FreeBSD platform cleanup (#205) - Fix default interface selection (#194), root detection on Unix (#192) - Dependency updates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Packet processor fix
Previously, each pcap_rx thread called recv_timeout(1ms) in a loop, timing out and re-entering up to ~1000
times/sec when idle — each timeout translating to a futex syscall. With 4 processor threads this produced ~4000
unnecessary syscalls/sec, visible as ~5% CPU usage per pcap_rx thread even under no traffic.
The new approach moves batching to tx side. This helps in cpu utilizations because they are awaken only on the arrival of messages. So, polling is removed from all threads. I can see visible perrformance improvement of cpu%. Its at ~3% compared to 15-20% range earlier in release version.
This is a trade off between batching, accuracy and cpu utilization on low end systems that have lesser number of packets.