Existe alguma maneira de alterar dinamicamente os pesos haproxy de acordo com as utilizações do servidor backend?

5

Existe algum utilitário que ajude a modificar os pesos do servidor de back-end com base na utilização do servidor de back-end? (por exemplo, feedbackd costumava fazer isso para o balanceador de carga LVS)

    
por aab 29.11.2012 / 11:21

2 respostas

2

Você pode tentar usar um algoritmo diferente de balanceamento de carga. leastconn parece ser o que você está procurando:

balance leastconn

De acordo com a documentação oficial do HaProxy v1.4

  leastconn   The server with the lowest number of connections receives the
              connection. Round-robin is performed within groups of servers
              of the same load to ensure that all servers will be used. Use
              of this algorithm is recommended where very long sessions are
              expected, such as LDAP, SQL, TSE, etc... but is not very well
              suited for protocols using short sessions such as HTTP. This
              algorithm is dynamic, which means that server weights may be
              adjusted on the fly for slow starts for instance.

Para comparar com o tradicional roundrobin :

  roundrobin  Each server is used in turns, according to their weights.
              This is the smoothest and fairest algorithm when the server's
              processing time remains equally distributed. This algorithm
              is dynamic, which means that server weights may be adjusted
              on the fly for slow starts for instance. It is limited by
              design to 4128 active servers per backend. Note that in some
              large farms, when a server becomes up after having been down
              for a very short time, it may sometimes take a few hundreds
              requests for it to be re-integrated into the farm and start
              receiving traffic. This is normal, though very rare. It is
              indicated here in case you would have the chance to observe
              it, so that you don't worry.
    
por 29.11.2012 / 11:28
1

Eu escrevi um utilitário para fazer exatamente isso, você pode baixá-lo no GitHub: haproxy-dynamic-weight . Ele fornece uma maneira de alocar de maneira dinâmica e automática o tráfego de haproxy entre os servidores proporcionalmente à carga deles.

Se este python & memcached solução não é para você, você verá a documentação do script se refere e vincula a duas alternativas.

    
por 12.04.2014 / 00:36

Tags