aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2015-03-02 18:41:29 +0300
committerRoman Arutyunyan <arut@nginx.com>2015-03-02 18:41:29 +0300
commitbf7d76b943d04b3f05a500689a111f54f27fe80f (patch)
tree22fad14d57d8b5d164d4b2b4ba2563b9fd865183 /src/http/ngx_http_request.c
parentde3adad8073d20404ce2e2b54f73aa9c72ce4e88 (diff)
downloadnginx-bf7d76b943d04b3f05a500689a111f54f27fe80f.tar.gz
nginx-bf7d76b943d04b3f05a500689a111f54f27fe80f.zip
Upstream hash: speedup consistent hash init.
Repeatedly calling ngx_http_upstream_add_chash_point() to create the points array in sorted order, is O(n^2) to the total weight. This can cause nginx startup and reconfigure to be substantially delayed. For example, when total weight is 1000, startup takes 5s on a modern laptop. Replace this with a linear insertion followed by QuickSort and duplicates removal. Startup for total weight of 1000 reduces to 40ms. Based on a patch by Wai Keen Woon.
Diffstat (limited to 'src/http/ngx_http_request.c')
0 files changed, 0 insertions, 0 deletions