При использовании выравнивания нагрузки TCP с HAProxy весь исходящий трафик течет через LB?

Пока Вы имеете в виду, что сторона сервера, прослеживающая всегда, оказывает некоторое влияние на производительность, и Вы уравновесили преимущество по сравнению с издержками затем, можно установить серверную трассировку для поиска:

19
задан 30 May 2012 в 16:08
3 ответа

HAProxy (like many load balancers) generally maintain two conversations. The Proxy has a session (tcp in this case) with the client, and another session with the server. Therefore with proxies you end up seeing 2x the connections on the load balancer. Therefore all traffic flows through the load balancer.

When it comes to scaling across multiple load balancers I don't think you need to. But a practical and fairly easy way to do this is use something like keepalived with two floating IPs and round robin DNS between those two IPs. With keepalived, if one of the load balancers goes down the other would hold both IPs, so you get high availability this way. That being said, I think you will be fine with one active haproxy instance with your load.

HAProxy scales very well. An an example, the Stack Exchange network use web sockets which maintain open TCP connections. While I am posting this we have 143,000 established TCP sockets on a VMware virtual machine with no issues. The CPU usage on the VM is around 7%.

With this sort of setup with HAProxy make sure you set maxconn high enough. Here is some example HAProxy config to get you started:

frontend fe_websockets
        bind 123.123.123.123:80
        mode tcp
        log global
        option tcplog
        timeout client 3600s
        backlog 4096
        maxconn 50000
        default_backend be_nywebsockets

backend be_nywebsockets
        mode  tcp
        option log-health-checks
        option redispatch
        option tcplog
        balance roundrobin
        server web1 10.0.0.1:1234
        server web2 10.0.0.2:1234
        timeout connect 1s
        timeout queue 5s
        timeout server 3600s
33
ответ дан 2 December 2019 в 20:17

Yes, all traffic should normally pass through the load balancer. The requests are received by the load balancer and the responses are sent back to the load balancer which sends them back to the clients.

For choosing the right tool, I don't have much experience about the other options. I am using haproxy and it is really good and stable and can handle a large amount of traffic. Also, its ACLs capabilities are great.

2
ответ дан 2 December 2019 в 20:17

Существует возможность использовать и настраивать DSR (прямой возврат сервера), но это не имеет ничего общего с Loadbalancer, а настраивается в tcp-стеке (таблицы маршрутизации). Мы использовали это для большого портала потокового видео. Несмотря на то, что это работает, у вас будет много проблем с необходимостью маршрутизации.

Таким образом, я бы не рекомендовал использовать эту технику без тщательного рассмотрения ее использования и недостатков.

Может быть, есть несколько советов, чтобы начать там:

Удачи!

2
ответ дан 2 December 2019 в 20:17

Теги

Похожие вопросы