bneradt commented on code in PR #14034:
URL: https://github.com/apache/trafficserver/pull/14034#discussion_r4591376352
##########
src/iocore/net/OpenSSLQUICNetVConnection.cc:
##########
@@ -893,12 +988,39 @@ QUICNetVConnection::stream_write_capacity(QUICStreamId
stream_id)
return -1;
}
- uint64_t avail = 0;
- if (SSL_get_stream_write_buf_avail(it->second, &avail) == 1) {
- return std::min<uint64_t>(avail, 16 * 1024);
+ // OpenSSL starts a stream's send buffer small and grows it only when one
write
Review Comment:
Nit: this whole approach depends on OpenSSL growing the send buffer only
when one write offers more than it has free. That is internal behavior, not a
documented contract. Could the comment name the OpenSSL code it relies on (the
sstream growth path in `ssl/quic/quic_impl.c`, as of 3.5)? Then whoever debugs
a throughput drop after an OpenSSL upgrade knows where to look. The growth and
defaults tests will catch the regression, but they won't say why it happened.
##########
src/iocore/net/OpenSSLQUICNetVConnection.cc:
##########
@@ -732,10 +745,47 @@ QUICNetVConnection::_process_openssl_streams()
{
std::vector<QUICStreamId> stream_ids;
stream_ids.reserve(this->_openssl_streams.size());
- for (auto const &entry : this->_openssl_streams) {
- stream_ids.push_back(entry.first);
+ std::vector<QUICStreamId> drained_ids;
+ size_t streams_with_data = 0;
+ this->_openssl_send_buffered = 0;
+ for (auto const &[stream_id, stream_ssl] : this->_openssl_streams) {
+ if (this->_openssl_draining_streams.count(stream_id) != 0) {
+ uint64_t const held = this->_openssl_stream_held(stream_id, stream_ssl);
+ if (held == 0) {
+ drained_ids.push_back(stream_id);
+ }
+ this->_openssl_send_buffered += held;
+ continue;
+ }
+
+ stream_ids.push_back(stream_id);
+ if ((SSL_get_stream_type(stream_ssl) & SSL_STREAM_TYPE_WRITE) == 0) {
+ continue;
+ }
+ this->_openssl_send_buffered += this->_openssl_stream_held(stream_id,
stream_ssl);
+
+ QUICStream *stream = static_cast<QUICStream
*>(this->_stream_manager->find_stream(stream_id));
Review Comment:
Nit: each pass now calls `find_stream()` twice per stream, here and again at
line 796 in the write loop. You could keep the `QUICStream *` from this loop
next to the ID in `stream_ids` (for example, a vector of `{id, stream}` pairs)
and use it in the second loop. One caveat: the second loop has to re-check that
the stream is still there if the first pointer can go stale between the two
loops (`receive_data` on an earlier stream could close one). If it can't go
stale, the saved pointer is a straight win on connections with many streams.
--
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]