summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_upstream_hash_module.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-11-07Upstream: re-resolvable servers.Ruslan Ermilov1-9/+79
Specifying the upstream server by a hostname together with the "resolve" parameter will make the hostname to be periodically resolved, and upstream servers added/removed as necessary. This requires a "resolver" at the "http" configuration block. The "resolver_timeout" parameter also affects when the failed DNS requests will be attempted again. Responses with NXDOMAIN will be attempted again in 10 seconds. Upstream has a configuration generation number that is incremented each time servers are added/removed to the primary/backup list. This number is remembered by the peer.init method, and if peer.get detects a change in configuration, it returns NGX_BUSY. Each server has a reference counter. It is incremented by peer.get and decremented by peer.free. When a server is removed, it is removed from the list of servers and is marked as "zombie". The memory allocated by a zombie peer is freed only when its reference count becomes zero. Co-authored-by: Roman Arutyunyan <arut@nginx.com> Co-authored-by: Sergey Kandaurov <pluknet@nginx.com> Co-authored-by: Vladimir Homutov <vl@nginx.com>
2019-05-23Upstream hash: fall back to round-robin if hash key is empty.Niklas Keller1-2/+2
2018-06-14Upstream: improved peer selection concurrency for hash and ip_hash.Ruslan Ermilov1-1/+7
2017-10-05Upstream hash: reordered peer checks.Maxim Dounin1-7/+7
This slightly reduces cost of selecting a peer if all or almost all peers failed, see ticket #1030. There should be no measureable difference with other workloads.
2017-10-05Upstream hash: limited number of tries in consistent case.Maxim Dounin1-3/+7
While this may result in non-ideal distribution of requests if nginx won't be able to select a server in a reasonable number of attempts, this still looks better than severe performance degradation observed if there is no limit and there are many points configured (ticket #1030). This is also in line with what we do for other hash balancing methods.
2016-09-22Upstream: max_conns.Ruslan Ermilov1-0/+9
2016-09-22Upstream: style.Maxim Dounin1-1/+0
2016-09-16Upstream hash: fixed missing upstream name initialization.Vladimir Homutov1-0/+1
2015-05-18Upstream hash: consistency across little/big endianness.Sergey Kandaurov1-4/+15
2015-04-21Upstream: simplified ip_hash and hash peer selection code.Ruslan Ermilov1-22/+8
Now that peers are stored as a list, the weighted and unweighted cases became nearly identical.
2015-04-14Upstreams: locking.Ruslan Ermilov1-0/+16
2015-04-10Upstream: store peers as a linked list.Ruslan Ermilov1-31/+40
This is an API change.
2015-04-10Upstream: track the number of active connections to upstreams.Ruslan Ermilov1-0/+4
This also simplifies the implementation of the least_conn module.
2015-03-02Upstream hash: speedup consistent hash init.Roman Arutyunyan1-21/+31
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.
2014-06-02Upstream: generic hash module.Roman Arutyunyan1-0/+631