Skip to content

consomme: perf improvements#3555

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

consomme: perf improvements#3555
Brian-Perkins wants to merge 4 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 Outdated
Comment thread vm/devices/net/net_consomme/consomme/src/tcp.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
@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

Copilot AI review requested due to automatic review settings May 27, 2026 01:44
@Brian-Perkins Brian-Perkins enabled auto-merge (squash) May 27, 2026 01:45
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

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

Comment on lines +455 to +458
// Reuse the scratch buffer to avoid per-packet heap allocation.
let mut buf = std::mem::take(&mut self.state.tx_scratch);
buf.clear();
buf.resize(meta.len as usize, 0);
Comment on lines +247 to +255
/// Bytes sent from host to guest.
bytes_tx_to_guest: Counter,
/// Bytes received from guest to host.
bytes_rx_from_guest: Counter,
/// Packets sent from host to guest.
pkts_tx_to_guest: Counter,
/// Packets received from guest to host.
pkts_rx_from_guest: Counter,
/// ACKs sent.
@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