ngx_http_upstream_vnswrr_module.
Introduction
The VNSWRR
module is an efficient load balancing algorithm that is smooth, decentralized, and high-performance compared to Nginx's official SWRR
algorithm.
Example
http { |
Installation
Build Tengine with this module from source:
|
Directive
vnswrr
Syntax: vnswrr |
Enable vnswrr
load balancing algorithm.
Performance
In the same pressure environment (wrk, 500 concurrency, keepalive, 2000 endpoint), the CPU consumption of VNSWRR
algorithm accounts for 0.27%
( ngx_http_upstream_get_vnswrr
).
Compared with VNSWRR
algorithm, the CPU consumption of SWRR
(ngx_http_upstream_get_peer
39%
) is an order of magnitude higher than VNSWRR
.
In the above environment, the QPS of VNSWRR
increases by 60%
compared with SWRR
algorithm.
Observing the changes of QPS and RT in the different back-end number scenarios.
Under SWRR algorithm, when the number of back-end for every 500 addition, then the QPS of Nginx decreases by about 10% and RT increases by about 1 ms. But under the VNSWRR algorithm, QPS and RT do not change much.