Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Upstream hash: speedup consistent hash init

Roman Arutyunyan
February 18, 2015 07:50AM
Hello,

On 18 Feb 2015, at 15:07, Wai Keen Woon <waikeen.woon@onapp.com> wrote:

> # HG changeset patch
> # User Wai Keen Woon <waikeen.woon@onapp.com>
> # Date 1424259253 -28800
> # Wed Feb 18 19:34:13 2015 +0800
> # Node ID 34578fd8055e08db2e7bf1e6637b26e92bb1a89b
> # Parent 3f568dd68af147b5ba259a27fdc6645f99e87aa7
> 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 4s.
>
> Replace this with a linear any-order insertion followed by qsort().
> Startup time for total weight of 1000 reduces to 40ms.

Thanks, we’ll look into this.

> Note that in the original implementation, if there are points
> with duplicate hash, only the first is kept. In this change, all
> are included.

This is the intended behaviour. Consistent hash array is build over
server entries, but not addresses resolved from them. Duplicate points
are ignored since most likely they refer to multiple addresses of
the same host.

[..]

--
Roman Arutyunyan
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Upstream hash: speedup consistent hash init

Wai Keen Woon 676 February 18, 2015 07:08AM

Re: [PATCH] Upstream hash: speedup consistent hash init

Roman Arutyunyan 342 February 18, 2015 07:50AM

Re: [PATCH] Upstream hash: speedup consistent hash init

Wai Keen Woon 299 February 19, 2015 12:34AM

Re: [PATCH] Upstream hash: speedup consistent hash init

Roman Arutyunyan 262 March 02, 2015 10:48AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 155
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready