If you are processing only hundreds of queries a second, then both are either seriously misconfigured, or the bottleneck is elsewhere.
If you are processing only hundreds of queries a second, then both are either seriously misconfigured, or the bottleneck is elsewhere.
At a glance the issue the difference though is caddy reverse proxy defaults to keepalive and nginx upstream does not. Enable keepalive in nginx and you’ll see similar performance.
I agree that there can be drawbacks - e.g. Nginx trying to use a keepalive connection while the backend already closed it due to badly aligned timeouts. That's a potential availability issue which can only be avoided by careful configuration. Client not supporting keepalives shouldn't be an issue, since Nginx is the client here.
That said I agree that using keepalive seems like a reasonable default - especially since other HTTP clients do the same.