Skip to content

consomme: perf improvements#3555

Open
Brian-Perkins wants to merge 2 commits into
microsoft:mainfrom
Brian-Perkins:consomme_perf
Open

consomme: perf improvements#3555
Brian-Perkins wants to merge 2 commits into
microsoft:mainfrom
Brian-Perkins:consomme_perf

Conversation

@Brian-Perkins
Copy link
Copy Markdown
Contributor

No description provided.

@Brian-Perkins Brian-Perkins requested a review from a team as a code owner May 22, 2026 16:56
Copilot AI review requested due to automatic review settings May 22, 2026 16:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets performance improvements in the net_consomme networking backend by reducing per-packet overhead in the virtio queue TX path and optimizing the TCP fast path (ACK behavior, socket settings) while adding richer diagnostics via inspectable counters/histograms.

Changes:

  • Reuse a TX scratch buffer in the queue to avoid per-packet heap allocations, and add a stored waker to wake the poll loop when RX buffers become available.
  • Update the TCP implementation to reduce ACK traffic (defer pure ACKs to poll cycles), disable Nagle (TCP_NODELAY), and refine window-scaling behavior to activate only after the handshake completes.
  • Add aggregate and per-connection TCP statistics for inspect/diagnostics.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
vm/devices/net/net_consomme/src/lib.rs Adds TX scratch-buffer reuse and queue waker handling to reduce allocations and improve wakeups when RX buffers reappear.
vm/devices/net/net_consomme/consomme/src/tcp.rs TCP-path perf/behavior changes (ACK coalescing, window-scaling activation timing, TCP_NODELAY) plus new inspect stats; includes a new “re-arm waker” read when TX buffer fills.

Comment thread vm/devices/net/net_consomme/src/lib.rs Outdated
Comment thread vm/devices/net/net_consomme/consomme/src/tcp.rs Outdated
Comment thread vm/devices/net/net_consomme/consomme/src/tcp.rs
Comment thread vm/devices/net/net_consomme/src/lib.rs Outdated
Comment thread vm/devices/net/net_consomme/consomme/src/tcp.rs
Comment thread vm/devices/net/net_consomme/src/lib.rs Outdated
Comment thread vm/devices/net/net_consomme/consomme/src/tcp.rs
Comment thread vm/devices/net/net_consomme/consomme/src/tcp.rs Outdated
Comment thread vm/devices/net/net_consomme/consomme/src/tcp.rs Outdated
// on outbound data if any becomes available. Without this,
// every guest packet would trigger a zero-payload ACK back,
// doubling packet rate and creating an ACK storm.
e.get_mut().inner.send_next(&mut sender, AckPolicy::Defer);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Here's where we do the defer thing. This seems to add a bunch of complexity--does this actually meaninguflly improve perf?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does meaningfully reduce the number of pure ACK packets. Just a simple scenario of connecting via RDP and opening edge (20s or so of usage) gave me a 25% reduction (~500 packets). How this translates to perf is less clear.

@github-actions github-actions Bot added the unsafe Related to unsafe code label May 22, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

@github-actions
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants