Caddy vs nginx benchmark

This might make for an interesting read:

https://blog.tjll.net/reverse-proxy-hot-dog-eating-contest-caddy-vs-nginx/

I lean towards using Caddy these days because of its many conveniences and an overall better configuration out of the box, and in my experience the quality of Caddy has massively increased in v2. However, nginx remains a solid performer, especially when tuned correctly and because of the lack of GC cycles.

Thanked by (3)saibal lorian Wolveix

Comments

  • I think nobody beats nginx. That's like the GOD of web servers... Nginx reverse proxy + Apache, such a banger. Nginx standalone even better.

  • I don't see a reason to use caddy after learning how to configure nginx. I get that caddy has intuitive configs, but that's not so helpful if I have to learn them instead.

    Having the server actually reload when certificates change is nice. I think the cluster awareness sounds useful too. Though, I have a nginx cluster running and it works great too (even though the servers have no idea that they're in a cluster).

    Thanked by (1)MannDude
  • @Hxxx said:
    Nginx reverse proxy + Apache, such a banger. Nginx standalone even better.

    Caddy reverse proxy + nginx website server, such as hipster.

    @mwt said:
    I get that caddy has intuitive configs, but that's not so helpful if I have to learn them instead.

    Caddyfile is cleaner than nginx config.

  • @yoursunny said:

    @mwt said:
    I get that caddy has intuitive configs, but that's not so helpful if I have to learn them instead.

    Caddyfile is cleaner than nginx config.

    Fair. I think my nginx configs are complicated because they do a lot of things though. I'd have to translate that to caddy. It might be cleaner, but if I'm making it do a lot of stuff, it probably won't be that much cleaner.

    I'll probably try caddy at some point, but I really like nginx and feel like it's become intuitive to me (even though it originally was not).

  • @mwt said:
    I don't see a reason to use caddy after learning how to configure nginx

    Better default configuration.
    The article shows there are pitfalls that you must be aware of when configuring nginx, this isn’t really the case with Caddy.

    Thanked by (1)yoursunny
  • @stevewatson301 said:

    @mwt said:
    I don't see a reason to use caddy after learning how to configure nginx

    Better default configuration.
    The article shows there are pitfalls that you must be aware of when configuring nginx, this isn’t really the case with Caddy.

    I wouldn't say that caddy's defaults are "better". Allowing your webserver to use all of your system resources by default isn't an objectively good thing. Most of the time, you expect other software on your system to need more resources than caddy/nginx.

    It's reasonable to allow the webserver to use all resources if you're only hosting static content with thousands of simultaneous visitors. It's also good if you're reverse proxying something that runs on a different server. It sounds terrible if you're doing anything dynamic though.

  • edited September 2022

    @mwt said: Allowing your webserver to use all of your system resources by default isn't an objectively good thing.

    Tack on CPUQuota=xx in the service's unit file. Much better than having to configure each service in its own way.

  • @stevewatson301 said:

    @mwt said: Allowing your webserver to use all of your system resources by default isn't an objectively good thing.

    Tack on CPUQuota=xx in the service's unit file. Much better than having to configure each service in its own way.

    Is that a systemd setting? I didn't know that existed. I should actually use that. I have some time insensitive junk that runs on fair use cores.

    I still think 1024 simultaneous connections is a sane default limit for one server. I think it makes some sense to expect someone with 1024 simultaneous connections on each node to not use the default config. From my perspective, that's a lot of connections.

    One core will probably be an issue on arm though. Distributions should probably change the default config for arm. Though, some might have done this already.

  • greenwebpagegreenwebpage Hosting Provider

    In my opinion is the best is nginx not saying Caddy is nto good but if you have any issue you can google it about nxginx and can rezolve any problem very fast
    This is my own opinion

  • @stevewatson301 said:

    @mwt said: Allowing your webserver to use all of your system resources by default isn't an objectively good thing.

    Tack on CPUQuota=xx in the service's unit file. Much better than having to configure each service in its own way.

    My systemd overrides for Caddy:

    sudo SYSTEMD_EDITOR=tee systemctl edit caddy <<EOT
    [Service]
    Restart=on-abnormal
    RestartSec=10s
    CPUAccounting=yes
    CPUQuota=10%
    MemoryAccounting=yes
    MemoryHigh=96M
    MemoryMax=128M
    EOT
    

    This was added after I got weaseled and Caddy crashed.


    @greenwebpage said:
    In my opinion is the best is nginx not saying Caddy is nto good but if you have any issue you can google it about nxginx and can rezolve any problem very fast

    the best is caddy not saying nginx is nto good but if i have any issue i can look at caddy source code and fix it very fast

    Thanked by (1)quicksilver03
  • @Hxxx said:
    I think nobody beats nginx. That's like the GOD of web servers... Nginx reverse proxy + Apache, such a banger. Nginx standalone even better.

    Nginx could be GOD until Cloudflare's Pingora release to the public. Cloudflare is currently using Nginx and they are building an in-house alternative to fix the issues they face in with their 1+ trillion requests per day. There is a good read on Cloudflare's blog on Pingora.

    Thanked by (1)Hxxx
  • @shmshd said:
    Nginx could be GOD until Cloudflare's Pingora release to the public. Cloudflare is currently using Nginx and they are building an in-house alternative to fix the issues they face in with their 1+ trillion requests per day. There is a good read on Cloudflare's blog on Pingora.

    Cloudflare only really does a few things. I'm sure Pingora will do those few things well but Nginx is still going to be the best general purpose web server. I don't think they're looking for feature parity here.

    Thanked by (2)JeDaYoshi ialexpw
  • @fluttershy said:
    Cloudflare only really does a few things. I'm sure Pingora will do those few things well but Nginx is still going to be the best general purpose web server. I don't think they're looking for feature parity here.

    This is something a lot of people often forget.
    I often hear claims like "this software is the best, it is much faster than this other one". Well yes, in your particular case that might very well be true, but to claim the title of "best" you need to excel in more than just one particular user case.
    When I get the question "which webserver should I use?" I always respond with "what do you want it to do?".

    As you say, I am sure Pingora excels in Cloudflares very specific circumstances. This does in no way whatsoever means it even stands a chance against nginx/caddy/apache in more "normal" use.

Sign In or Register to comment.