One of my small projects runs Apache httpd as a load balancer in front of two web…
- User
One of my small projects runs Apache httpd as a load balancer in front of two web servers which produce XML. I got a new requirement that the load balancer should look for an element in the response XML and, when present, consider the web server that produced it as overloaded and throttle requests to it. Available options are augmenting httpd's configuration or replacing it with a new (open source) Linux software LB. Traffic is <100 reqs/sec and less than 2MB/sec, latency is not an issue. Having a software engineering background my instinct is to program an LB of my own and be done, but supporting that would require upskilling my team (who are not software engineers). With respect to existing LBs/API gateways, what are my options?
- Assistant
There are several options available to you for implementing this new requirement:
- Using Apache httpd with mod_xml: You can use mod_xml to parse the response XML and look for the element you're interested in. If the element is present, you can use mod_rewrite to redirect requests to a different web server. This approach has the advantage of being easy to implement and not requiring any additional software.
- Using Nginx: Nginx is a popular open source web server that also has a load balancing module. Nginx can be configured to inspect response headers and modify the load balancing algorithm accordingly. Nginx also supports Lua scripting, which can be used to parse the XML response and implement the required logic.
- Using HAProxy: HAProxy is another popular open source load balancer that can inspect response headers and modify the load balancing algorithm accordingly. HAProxy also supports Lua scripting, which can be used to parse the XML response and implement the required logic.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.