0

I need to have a web load balancer with active health check.
This frontend machine should handle https certificate, a bit of caching and, most important, proxy to backend server only if they are healthy.

I tried nginx but unfortunately I discovered nginx opensource supports only passive health checks and then I have few alternatives.

  • Trying to use one of forks for nginx active health check, not supported and probably hard to install.
  • Develop a custom bash script, set in in a cron schedulation, to check the health of servers that changes the nginx configuration and reload the instance.
  • Install HAProxy that supports active health check and configure it in cascade from nginx. So nginx will handle certificate and caching and will proxy to local HAProxy, then HAProxy will handle just the balancing with health check.

I have few doubts for all solutions. The last one seems to be the most solid, but is it a good idea to have 2 webserver in the same machine? Does it make a lot overhead?

I expect this machine will handle hundreds request per seconds, the machine is Ubuntu 22 server with 2GB Ram and 1 core.

2 Answers 2

0

I wouldn't worry too much about having multiple web servers / proxies on the same server. The connections between them over localhost will be very fast. HAProxy is definitely the best answer in my opinion, and it does support caching:

https://www.haproxy.com/documentation/haproxy-configuration-tutorials/network-performance/caching/

However, this is a super fast in memory cache for small files, NOT a general purpose SQUID type cache. For the very good reason that a larger general purpose cache is a complete resource hog. Why would you not use multiple servers in the cluster behind HAProxy to get the performance you need? That is after all the purpose of a load balancer. So I would sugest that you do termination + limited caching + dynamic health checks (agent based) and loadbalancing with HAProxy. Or just skip the caching completley.

Ps. Blatant advertising but, We have open sourced our Windows feedback agent for HAProxy if you need one:

https://www.loadbalancer.org/blog/open-source-windows-service-for-reporting-server-load-back-to-haproxy-load-balancer-feedback-agent/

And a cross platform linux binary will be released in a couple of weeks. I'll update the same blog with the information then.

1
  • Thanks Malcolm for your answer and for the reccomendation! So you're suggesting to remove nginx... Probably you're right I can skip the first step.
    – Tobia
    Commented Apr 29 at 12:29
0

OpenResty is a wrapper of (latest-1 or latest-2) Nginx + Lua, and gets powerhouse Network I/O out of the Box due to great supporting modules for most business' needs. OpenResty includes a recently maintained Lua module that does Active Health Checks using OpenSource Nginx here: https://github.com/openresty/lua-resty-upstream-healthcheck

From the install notes:

"If you are using OpenResty 1.9.3.2 or later, then you should already have this library (and all of its dependencies) installed by default (and this is also the recommended way of using this library)..."

Hence there isn't any "not supported and hard to install." I also emphasize OpenResty does not fork Nginx, but wraps it with other functionality for a powerful Solution source out of the box.

I have used OpenResty almost exclusively since 2014 in Production (Debian, as it so happens) and specialized in Nginx since 2012, so I admit I am biased because I love what I can get done with it... but I am not actually against HAProxy as much as I am in love with Nginx and the flexibility to combine or (natively) coalesce operations such as Monitoring and BI along with solutions such as Cache and Load Balancing...and so much more.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .