-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Implement proper payload chunked encoding in HTTP api_v3 #6467
Comments
This looks like an interesting issue. Using chunks, we can send streams of unknown size as a sequence of length-delimited buffers. The exact HTTP/1.1 specification for chunked encodings are present at https://datatracker.ietf.org/doc/html/rfc7230#page-36 Compression handling could be a little tricky to implement. I'll need to investigate how compression handling (if used) interacts with chunked encodings. Then we can decide on an approach to handle both functionalities. Currently, there are two possible options in mind:
I'm more inclined towards the first approach as it handles everything on the server side. But we'll need to analyze how it affects the performance, thoughts? |
https://stackoverflow.com/questions/5280633/gzip-compression-of-chunked-encoding-response suggests the following approach:
|
to me that sounds like an approach that defeats the purpose of streaming. Yes, the content is sent in smaller chunks, but the client cannot do anything with the content until it receives all of it. We used to use https://github.com/grpc-ecosystem/grpc-gateway to serve APIv3 over HTTP. I would recommend reading their docs to understand how they are handling streaming responses. We did borrow the |
@yurishkuro, thank you for the pointers. @chahatsagarmain, I just saw that you raised a PR to implement this feature. As you can see, I was also interested in working on this. I believe it is common courtesy to at least ask the other person if they're working on it rather than just submitting a PR, knowing that somebody else has shown interest in working on the same topic. Contributing to open-source projects is about collaboration, not competition. I don't have much experience with Jaeger's codebase, so it took me some time to figure things out. But great, now we already have an open PR targeting this enhancement. |
Chunked encoding allows HTTP endpoint to stream the results back to the client incrementally, which works well with our Query Service v2 streaming interface. The
http.Server
should support that automatically through the use ofhttp.Flusher
APIHowever, this ^ example may be wrong and we may need to do something special for chunked encoding, which according to spec should look like
(i.e. each chunk is preceeded by a hex-encoded length on a new line).
The example of reading the correct chunked encoding:
Additional consideration: our HTTP server supports compression, so need to figure out how that affects the response protocol.
The text was updated successfully, but these errors were encountered: