Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Poll: Are client web requests sent to upstream servers or downstream servers?
2 points by Jupe on March 11, 2022 | hide | past | favorite | 2 comments
I hear both terms used in either direction. It can be somewhat confusing!

The HTTP spec indicates the requests are "downstream" and dependencies are "upstream" [1]

nginx indicates the opposite [2], even naming modules based on "upstream" being the direction of dependencies.

It may seem trivial, but I get a twinge in the back of my neck every time I hear one over the other; I believe others may have a similar experience. Perhaps the considerable knowledge and experience of the HN community can help clear this up?

Simple example:

  Client -> Proxy -> Load Balancer -> Gateway -> Application Server -> Database
            <-       <-               <-         <-                    <-
On the one hand, it just seems natural that "upstream" refers to the inbound request being sent from one system to another. It takes effort (connection pooling, throttling, retries, etc.) to make a request to an (upstream) dependency, just as it takes effort to swim upstream. The response is (usually) easy... just return it... hence, "downstream". Recall the usual meaning of "upload" and "download". Upstream seems to make sense when talking about processing/effort.

But conversely, an individual client request is like a drop of water, that feeds into a trickle (proxy), that moves through the larger load balancer, etc. Certainly, the application server's database is most likely much larger than the client. So, the size of the stream (usually) gets larger the deeper into the stack a request goes. Downstream seems to make sense when talking about data size/volume.

[1] https://datatracker.ietf.org/doc/html/rfc7230#section-2.3

[2] https://nginx.org/en/docs/http/ngx_http_upstream_module.html

Client requests are sent upstream to servers and their dependencies.
2 points
Client requests are sent downstream to servers and their dependencies.
1 point
Depends on topic at hand: processing vs. data volume,
1 point
No opinion.
1 point


This is similar to the old debate about the meaning of "frontend" and "backend". I maintain that something cannot be a "frontend" or a "backend" in isolation, it can only be a frontend or a backend to some other system. In a stack with many layers, (nearly) every layer is a frontend to one thing and a backend to another.

That said, I think I tend to use "upstream" in a similar sense to how package maintainers talk about packages: "upstream" is the source (where the thing originally came from) and "downstream" is the sink (where I will send it to). This implies that "upstream" for a request is "downstream" for a response, and vice versa. I don't know if that's necessarily correct usage, but that's how I've done it.


nginx does not indicate the opposite. In nginx upstream refers to the next source/server it should pass the request on to.

E.g. nginx receives a request and passes it on to the configured upstream, the application server, before receiving a response that is passed downstream to the UA.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: