[haproxy] Avoid unnecessary HAProxy re-configuration.
[haproxy] Avoid unnecessary HAProxy re-configuration.

Currently, on every topology update event Synapse sends re-enable commandto HAProxy for
every live backend instance, even though that instance may already be UP. The number of
such backend instances can be quite significant, so after every single topology update
Synapse may send thousands of re-enable commands which are essentially noops.

The following changes were made to address the problem:

1. HAProxy command batching: commands are now sent in groups of 4 or less, which reduces
   overall number of syscalls per topology update event.

2. Re-enable command is now sent only if a given instance status is not UP.

3. Minor performance improvements in HAProxy stats parsing code (~35% time/cpu savings).

airbnb/synapse,Yelp/synapse