bneradt commented on code in PR #13554:
URL: https://github.com/apache/trafficserver/pull/13554#discussion_r3854801149


##########
src/iocore/net/QUICNetVConnection.cc:
##########
@@ -688,6 +688,23 @@ void
 QUICNetVConnection::_handle_write_ready()
 {
   if (quiche_conn_is_established(this->_quiche_con)) {
+    // Count real contention for THIS event before deciding its budget, rather 
than
+    // sizing it from a previous event's count -- a stale count can be wrong 
in either
+    // direction whenever contention swings between events, not just on the 
first
+    // event. writable() is a pure, side-effect-free snapshot (verified against
+    // quiche's source), so draining it twice costs one extra O(n) collect and 
n extra
+    // FFI calls, n bounded by this connection's stream limit -- cheap next to 
the
+    // per-stream work that follows.
+    quiche_stream_iter *probe          = 
quiche_conn_writable(this->_quiche_con);
+    uint64_t            probe_id       = 0;
+    size_t              writable_count = 0;
+    while (quiche_stream_iter_next(probe, &probe_id)) {
+      ++writable_count;

Review Comment:
   **[P2] Count streams that actually have data to send.**
   
   `quiche_conn_writable()` reports every unfinished stream with flow-control 
capacity, not just streams with queued application data ([quiche 0.28 
`StreamMap::writable()`](https://github.com/cloudflare/quiche/blob/0.28.0/quiche/src/stream/mod.rs#L628-L633),
 
[`Stream::is_writable()`](https://github.com/cloudflare/quiche/blob/0.28.0/quiche/src/stream/mod.rs#L786-L793)).
 For example, with 20 open request streams but response data available on only 
one, `writable_count` is 20, so the active stream receives the 16 KB floor 
while the other 19 consume none of their budgets. This repeats every event and 
effectively restores the original per-stream limitation. Please base the 
divisor on ATS streams whose `QUICStream::has_data_to_send()` is true; ideally 
collect that filtered snapshot once and reuse it for the send loop. The QMux 
path has the same issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to