LVS与其他负载均衡软件的区别

HAProxy作者Willy讨论了HAProxy与LVS在处理并发连接方面的不同。HAProxy作为基于代理的负载均衡器,需要更多内存来处理每个连接,而LVS作为基于包处理的负载均衡器,在高连接速率下可以支持更多的并发连接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

有人在邮件列表问haproxy的作者为何haproxy无论是tcp模式还是http模式,能支撑的并发量都不是太大。

Willy回答了这个问题。
 
Exactly. The difference is between LBs that process a stream and which
are proxy-based,
and the ones which process packets and are basically
routers
. In order to parse and modify a stream, you need some memory,
while you don't need this to route packets (beyond the routing queue).
L4 load balancers often store a session table which is a few hundreds
of bytes per session, as opposed to a few tens of kB of buffers for
proxies. However, L4 LBs have to deal with TIME_WAIT, which proxies
don't since it's done in the system, so in practice, the ratio is not
really tens-of-thousands to millions but rather tens-of-thousands to
hundreds-of-thousands when the connection rate are high.

> and why in HAProxy
> you can have "only" thousends of connections while LVS like LBs can
> annouce millions...
> So in haproxy, whatever the mode, tcp or http, you'll always have
> thousends of connexions.

In fact it depends a lot on the configured memory and on the kernel
tuning. With todays 64-bit systems and cheap RAM, there's plenty of
margin. We had one user who reported 1 million established connections
in a bench, and several ones reported more than 300k in production. In
Linux, by default, processes are limited to 1 million FDs so you need
to patch the kernel or to run in multi-process mode for this. I assume
it's not that crazy to run several processes when you have to deal with
1 million concurrent connections :-)
 
 
if you don't need any form of session persistence or content switching,
LVS might be more suited for this usage.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值