Caddy vs SSLDocker vs Nginx , which is the best suitable web server for your vps ? I tested their performance with step by step tutorial
# ./hey -n=20000 -c=5 [url=https://mydomain.com/]https://mydomain.com/[/url]
2. Caddy results:
Summary:
Total: 64.9214 secs
Slowest: 0.7156 secs
Fastest: 0.0031 secs
Average: 0.0161 secs
Requests/sec: 308.0650
Response time histogram:
0.003 [1] |
0.074 [19888] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
0.146 [2] |
0.217 [2] |
0.288 [2] |
0.359 [90] |
0.431 [1] |
0.502 [11] |
0.573 [1] |
0.644 [1] |
0.716 [1] |
4. SSLDocker results:
Summary:
Total: 63.0618 secs
Slowest: 0.4883 secs
Fastest: 0.0030 secs
Average: 0.0156 secs
Requests/sec: 317.1490
Response time histogram:
0.003 [1] |
0.052 [19865] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
0.100 [1] |
0.149 [2] |
0.197 [1] |
0.246 [0] |
0.294 [15] |
0.343 [95] |
0.391 [0] |
0.440 [2] |
0.488 [18] |
5. Nginx (openresty) results:
Summary:
Total: 57.8501 secs
Slowest: 0.0523 secs
Fastest: 0.0029 secs
Average: 0.0144 secs
Requests/sec: 345.7212
Response time histogram:
0.003 [1] |
0.008 [539] |∎∎
0.013 [4327] |∎∎∎∎∎∎∎∎∎∎∎∎∎
0.018 [13150] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
0.023 [1397] |∎∎∎∎
0.028 [404] |∎
0.033 [120] |
0.037 [35] |
0.042 [18] |
0.047 [4] |
0.052 [5] |
6. Requests per second (RPS)
Caddy 308 < SSLDocker 317 < Nginx 345
Nginx and SSLDocker have better performance
Caddy config:
mydomain.com {
gzip
proxy / 127.0.0.1:8999
}
mydomain2.com {
proxy / 127.0.0.1:8888
}SSLDocker config:
{
"Email": "[email protected]",
"GzipOn": true,
"Http2https": true,
"MaxHeader": 10,
"Certs": "certs",
"ProxyItems": [
{"Host": "mydomain.com", "Target": "[url=http://localhost:8999"]http://localhost:8999"[/url]},
{"Host": "mydomain2.com", "Target": "[url=http://localhost:8888"]http://localhost:8888"[/url]}
]
}Nginx config:
server {
listen 443;
server_name mydomain.com;
ssl on;
ssl_certificate /root/ssl/chained.pem;
ssl_certificate_key /root/ssl/domain.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA;
ssl_prefer_server_ciphers on;
location ^~ /.well-known/acme-challenge/ {
alias /var/www/myapp/;
try_files $uri =404;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass [url=http://127.0.0.1:8999;]http://127.0.0.1:8999;[/url]
}
}So When should you use caddy and ssl docker?
my answer: if you run multiple websites,and each website use https .if you think it's hard and complex to config https ,you should use caddy and SSLDocker, they would auto generate ssl . Nginx is stable and mature , you can search lots of solutions when you meet issues.