Configuring the HAProxy router
The HAProxy router balances loads and routes traffic in cloud and container orchestration systems such as Red Hat® OpenShift®. You can scale the HAProxy router ingress controller, set the maximum number of concurrent connections, and select a different log balancing algorithm.
Scaling the Ingress controller
The peak number of concurrent incoming connections is the primary factor that influences the number of ingress pods to create. Each ingress pod in the Red Hat OpenShift HAProxy can support up to 20,000 incoming TCP connections per pod.
To scale the default ingress controller to a specific number of replicas, use the oc
patch command in the Red Hat OpenShiftcommand-line interface. The
following example scales the default ingress controller to 3 replicas:
oc patch -n openshift-ingress-operator ingresscontroller/default --patch '{"spec":{"replicas": 3}}' --type=merge
Setting the maximum number of concurrent connections
The HAProxy router can handle a default maximum of 20,000 concurrent connections, but this limit
can be adjusted as needed. To configure the maximum connections, you can use the
--max-connections option.
oc edit ingresscontroller default -n openshift-ingress-operator
spec:
tuningOptions:
maxConnections: 10000
Also, you can modify the ROUTER_MAX_CONNECTIONS environment variable in the router’s deployment configuration to change the limit after which the router pods restart with the new value. If ROUTER_MAX_CONNECTIONS is not present, the default value of 20,000 is used.
However, it is crucial to verify that the node settings are configured to handle the specified connection limit. The sysctl fs.nr_open and sysctl fs.file-max system parameters must be large enough to support the increased max connections or HAProxy will not start.
Red Hat OpenShift Container Platform does not support modifying ingress controller deployments by using environment variables, such as ROUTER_THREADS and ROUTER_DEFAULT_TUNNEL_TIMEOUT, because these values are overwritten if the ingress operator is enabled.
Changing the load balancer algorithm
Starting in Red Hat OpenShift Container Platform 4.10, the following load-balancing algorithms are available:
- source
- roundrobin
- random, which is used by default
- leastconn
Use the random algorithm because it yields a balanced distribution of incoming connections to the IBM® Maximo® Application Suite pods.
oc annotate --overwrite route/example-route haproxy.router.openshift.io/balance=roundrobin