Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for High Mempool Drops on UDP Connections #43

Merged
merged 2 commits into from
Sep 7, 2024

Conversation

thearossman
Copy link
Collaborator

@thearossman thearossman commented Sep 5, 2024

We were seeing issues with UDP performance, especially with connection-level subscriptions. Mempool usage would spike and after a while lead to high drop rates.

Observing that every packet that passes the packet-level filtering step will be passed along to the connection table and either processed or inserted.

When an ongoing UDP connection is removed from the connection table (e.g., application-layer parsed and filter didn't match), there's nothing to keep subsequent packets from being re-inserted when the next packet is received.

This PR keeps UDP connections around in the connection table in a "dropped" state until the timerwheel ages them out. This seemed like the most straightforward approach - open to other ideas.

Tested: ran log_dns and log_quic (anonymized IPs) on offline and online mode, with both application-layer data and connections. Mempool usage stayed relatively stable and output still looks correct. In contrast, without this commit, mem usage steadily increases (and doesn't go down) over time when run for multiple minutes.

For example, logging DNS and QUIC connections had 12% drop rate after 80 seconds without this commit and 0.002% drop rate after 80 seconds with this commit.

Note - see some documentation of the issue here: #37 (comment)

- UDP performance is bad for connection-level subscriptions, due
  to UDP connections being re-inserted in connection table.
- This is one proposed solution: keep UDP connections around in
  the connection table in a "dropped" state until the timerwheel
  ages them out.

Testing done:
- Ran log_quic and log_dns on both live traffic (anon ips) and pcaps
- Output on live traffic was reasonable; output on pcaps was correct
- Repeated with log_* with connection-level subscriptions (Connection)
@thearossman thearossman changed the title Fix for High Mempool Usage on UDP Connections Fix for High Mempool Drops on UDP Connections Sep 5, 2024
@thegwan
Copy link
Contributor

thegwan commented Sep 6, 2024

LGTM, thanks!

@thearossman thearossman merged commit 335a798 into stanford-esrg:main Sep 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants