My overall experience with Caddy + Some ideas

Hi Robert!

Could you provide a use case for this feature?
Most times your webserver won’t be your cpu hog but the dynamic language interpreter behind it (like PHP)

This is Caddy eating my CPU by itself on a single-core VPS I use as my local testing server (it has an Intel® Xeon® E5-2620 inside), running Ubuntu 16.04.1 LTS:

This is why I need to limit it per domain. I’m not using any CMS (such as Wordpress, Joomla, etc) or Framework (PHPCake, CodeIgniter, etc), everything is custom PHP code made from scratch (and no, it’s not resource intensive).

Let’s stick with the PHP example for a second:
Caddy and the PHP Interpreter are two different, autonomous processes. So you can limit your PHP Workers without changes to Caddy. You can even control the memory limit of PHP Workers directly from your Caddyfile via env PHP_VALUE "memory_limit = 512M"

Is memory_limit per worker, or total memory limit of PHP for that domain? Do I need to make a new PHP-FPM pool per domain to apply your solution?

Thanks, for your answer, I’ll test that.