Caddy Keepalive not working when Benchmarking with ab


(Ankit Timbadia) #1

**edit
Not able to post more than 4 URL
so refer to this endpoint where I have specified URL
URL: demo.mysite.com

Hi,
We are planning to use Caddy for offloading SSL (TLS 1.2) and Nginx to Proxy the request to other services.
Caddy runs on 443 > Nginx on Port 80
My config for Caddy looks something like this

0.0.0.0:443
gzip
log /var/log/caddy/access.log

tls /etc/ssl/seceret.crt /etc/ssl/private/seceret.key

proxy / localhost:80 {
transparent
keepalive 2000
}
As per this documentation, I was able to set the Keepalive value for the nginx (Downstream) https://caddyserver.com/docs/proxy

When running the following
curl https:// URL/ -vvvvv --next https:// URL/

  • Connection #0 to host URL left intact
  • Found bundle for host URL: 0x555a318c0a40 [can pipeline]
  • Re-using existing connection! (#0) with host URL
    This shows Keepalive is enabled as Curl uses the same connection.

But when i run ab ab -n5000 -k -c100 https:// URL/

Failed requests: 0
Keep-Alive requests: 0
Total transferred: 18500000 bytes
HTML transferred: 17370000 bytes
Requests per second: 288.78 [#/sec] (mean)

I tried siege / hload, but saw the same behavior. During Benchmarking my setup Caddy 443 and Nginx does not seem to use Keepalive.

I tried Running nginx on 443 and doing the benchmark with ab. I could see Keep-Alive requests

I tried running Caddy directly on port 80 to serve the payload, their keepalive seems to be working fine.

I also tried Caddy running on port 80 and doing a proxy to another caddy server running on port 580 something similar to this setup https://github.com/mholt/caddy/issues/938
There also I see caddy reusing the existing connection, so keepalive seems to be working fine.

Anything which I am missing?
Does Caddy have any parameter where we can see Keepalive for Upstream?

Thanks,
Ankit Timbadia