Load balancers are the point of entrance to the datacenter. They are on the critical path to access anything and everything.
That give them some interesting characteristics. First, they are the most important thing to monitor in an infrastructure. Second, they are in a unique position to give insights not only about themselves but also about every service that they are backing.
There are two popular open-source software load balancers: HAProxy and nginx. Let’s see how they compare in this regard.
Enable monitoring on the load balancers
The title is self explanatory. It should be systematic for everything going to production.
- Install something new
- Enable stats and monitoring stuff
- Enable logs
Enabling nginx status page
Edit /etc/nginx/nginx.conf:
server {
listen 0.0.0.0:6644;
access_log off;
allow 127.0.0.0/8;
allow 10.0.0.0/8;
deny all;
location / {
stub_status on;
}
}
Enabling HAProxy stats page
Edit /etc/haproxy/haproxy.cfg:
listen stats 0.0.0.0:6427
mode http
maxconn 10
no log
acl network_allowed src 127.0.0.0/8
acl network_allowed src 10.0.0.0/8
tcp-request connection reject if !network_allowed
stats enable
stats uri /
Collecting metrics from the load balancer
There are standard monitoring solutions: datadog, signalfx, prometheus, graphite… [2]
These tools gather metrics from applications, servers and infrastructure. They allow to explore the metrics, graph them and send alerts.
Integrating the load balancers into our monitoring system is critical. We need to know about active clients, requests/s, error rate, etc…
Needless to say, the monitoring capabilities will be limited by what information is measured and provided by the load balancer.
Sorted by order of awesomeness. Leftmost is better.
0 comments:
Post a Comment