Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize HttpReceiverOverHTTP #12607

Open
sbordet opened this issue Dec 3, 2024 · 0 comments
Open

Optimize HttpReceiverOverHTTP #12607

sbordet opened this issue Dec 3, 2024 · 0 comments
Assignees

Comments

@sbordet
Copy link
Contributor

sbordet commented Dec 3, 2024

Jetty version(s)
12.1.x

Enhancement Description
HttpReceiverOverHTTP has a rather complex, re-entrant, logic that can be improved, likely with impacts to HttpReceiver and therefore other transports.

In particular:

  • If it is known that there is no content (Content-Length: 0, HEAD requests, 204 No Content responses), we should skip allocating the Content.Source and notifying Response.ContentSourceListener.
    This could affect all the transports, and for HTTP/2 and HTTP/3 is even simpler: there is no content of HeadersFrame.last=true.
  • HttpReceiverOverHTTP could optimize the number of syscalls to read() and NIO, as currently it performs at least 1 extra syscall to read zero from the network.
    This needs to be carefully analyzed, because responseSuccess() may trigger the send of a queued request, and an attempt to read in receiveNext() may read the response of the queued request that was just sent.
    Is it worth to try to read the next response, costing a buffer acquire, network read, and NIO read interest, versus just skipping the read and going directly to NIO read interest?
@sbordet sbordet self-assigned this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant