Hi, just thought I’d show some graphics on CPU usage from DO after moving from Nginx to Caddy.
The Nginx machine had two GB of RAM and 2 CPU cores. The Caddy machine has 1 core and 2 GB of RAM.
Load is largely the same – about 1-3 connections per second (and multiple files give out via each connection)
The switch happend at 4:45 PM.
Nginx CPU graph:
Note that the CPU use on caddy is very smooth. I have no idea why. Nginx was self-compiled with pagespeed module (the latest stable version).
Also, I don’t notice any quic requests, even though quic is enabled (I tested using Chrome). All requests seem to be http2. Any idea why that’s so? This server basically serves static content (mostly images).
Very interesting! It could have something to do with the fact that Caddy doesn’t have a pagespeed equivalent, so perhaps it’s doing less work in that sense.
Might also have to do with the fact that Go’s garbage collector runs concurrently and in very, very quick, short, and possibly frequent intervals. Would be interesting to see what your Caddyfile is like, to know which middlewares are being invoked.
A better explanation could be given by profiling; you might also enable the
expvar directives to gain insights.
definitely a possibility as ngx_pagespeed module does on the fly image optimisations i.e. converting jpg/png to webp as well as optimise css/js assets on the fly so depending on nginx pagespeed filters configured/enabled, cpu load could be higher. The more image heavy your pages accessed through ngx_pagespeed optimised filters, the more cpu usage it would involve though it can be tuned via ngx_pagespeed settings as well.
old youtube video explaining what nginx pagespeed/ apche mod_pagespeed modules do
The real comparison would be doing tests without ngx_pagespeed enabled/integrated and/or doing page load speed tests via webpagetest.org for comparison of nginx + ngx_pagespeed versus caddy in this case. I wrote a guide on how to use webpagetest.org for pagespeed testing https://community.centminmod.com/threads/how-to-use-webpagetest-org-for-page-load-speed-testing.13859/ that @elos42 could test if you still have access to both old nginx server and current caddy server configs
Also check the memory usage too.
It’s just a static file server. So there are practically no middleware being called I think.
tls /etc/ssl/caddy/fullchain.pem /etc/ssl/caddy/privkey.pem
header / Strict-Transport-Security "max-age=31536000;"
It’s probably pagespeed module. I’ve kept the default settings. I don’t think it converts to webp on default settings. Not sure.