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


##########
src/proxy/hdrs/HdrTSOnly.cc:
##########
@@ -117,10 +120,13 @@ HTTPHdr::parse_resp(HTTPParser *parser, IOBufferReader 
*r, int *bytes_used, bool
 
     end = start + b_avail;
 
+    // A field can be split across blocks, so only the last block ends the 
input.
+    bool const block_eof = eof && b_avail >= r->read_avail();

Review Comment:
   [P3] Avoid repeatedly scanning the remaining buffer chain
   
   IOBufferReader::read_avail() walks every remaining IOBufferBlock, so calling 
it once per parsed block makes this EOF check quadratic in the number of 
blocks. The new 900 KiB bodyless case has 225 4 KiB blocks, resulting in 
approximately 25,425 block visits just to decide which block is last. This adds 
avoidable work on the event thread precisely for the large headers this fixes. 
Could we compute the available byte count once when eof is true and subtract 
used after each consume, then compare b_avail against that remaining count? The 
same suggestion applies to parse_req above. That preserves the EOF behavior and 
the reader's size_limit semantics with a single initial scan.



-- 
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