Optimal systemd configuration for Caddy?

I was wondering what is the ideal systemd configuration for optimal Caddy performance?

I have the following on the caddy.service file:

      LimitNOFILE=1048576
      LimitNPROC=512
      AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE

Is that enough for Caddy to maximize the CPUs of the machine?

1. The problem I’m having:

Not a problem, but a question.

2. Error messages and/or full log output:

No errors.

3. Caddy version:

v2.8.4

4. How I installed and ran Caddy:

Running binaries from github

a. System environment:

Debian 12

b. Command:

No special command.

c. Service/unit/compose file:

No special unit.

d. My complete Caddy config:

No special config.

5. Links to relevant resources:

No links.

If you install using our apt repo, it ships with a systemd config:

You can find our systemd config here:

There’s nothing special to change. Caddy is written in Go, which automatically scales to the amount of available CPU threads.

1 Like

Would you say those issues are obsolete, then?

Nothing to tune at all?

We’ve already dropped LimitNPROC (because a good point was made that it doesn’t work the way we expected), and TasksMax wasn’t available in all supported OS versions we needed until just recently. But setting TasksMax isn’t really necessary, Go’s execution model doesn’t really necessitate it.

3 Likes

Not directly related, but I think AllowedCPUs= can be used to limit how many CPU cores can be used.

Otherwise, TasksMax, seems to be what you want if you indend to limit amount of pids.

But what is the end goal with setting various cgroup settings? Perhaps just tune cpu.weight for your services is enough?

https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.