Stream a Body With Trailers in hyper 1.0 and axum 0.7
Hyper supports sending HTTP/1.1 Chunked Trailer Fields as of v1.1.0. The http-body is now at v1.0 as well and uses frames to allow a stream to return data and trailers.
Hyper supports sending HTTP/1.1 Chunked Trailer Fields as of v1.1.0. The http-body is now at v1.0 as well and uses frames to allow a stream to return data and trailers.
I was reading How fast is your shell? and it got me thinking about the difference types of speed developers prioritize. A lot of articles and advice focus on initial startup, which can be thought of as acceleration. We should also consider, what happens after we are done accelerating, how easy it is to maintain our velocity.
I saw this statement in an accepted answer on Stack Overflow:
Retrieving the value of an environment variable will incur a system call.
This answer surprised me as I did not think this was the case. There is an edit farther down that has links to other Stack Overflow posts saying get getenv
does not make a syscall. Let us prove it ourselves.
At work, I lead a team responsible for a Node.js service that serves a lot of GraphQL queries. We recently noticed some servers in the cluster were running much slower than others. We had used 0x in the past to profile Node.js services locally. In this case, we could not identify the problem locally and needed a solution to profile Node.js in production to identify the cause of the slowdown.
Hyper is designed to support streaming bodies. The current version of axum, v0.6, supports streaming a response. If we want to include trailers (sometimes called "trailing headers") then we need to implement our own custom body.