diff options
author | Nick Vatamaniuc <vatamane@gmail.com> | 2021-09-08 18:20:46 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2021-09-09 10:44:21 -0400 |
commit | 4ea9f1ea1a2078162d0e281948b56469228af3f7 (patch) | |
tree | 888f8b516a5132c3131e41e7b54d20a1c59296e7 /rel/overlay/etc/default.ini | |
parent | 64281c0358e206a54e3b1386a7bc3b3e7c30547f (diff) | |
download | couchdb-4ea9f1ea1a2078162d0e281948b56469228af3f7.tar.gz |
Improve fabric_util get_db timeout logic
Previously, users with low {Q, N} dbs often got the `"No DB shards could be
opened."` error when the cluster is overloaded. The hard-coded 100 msec timeout
was too low to open the few available shards and the whole request would crash
with a 500 error.
Attempt to calculate an optimal timeout value based on the number of shards and
the max fabric request timeout limit.
The sequence of doubling (by default) timeouts forms a geometric progression.
Use the well known closed form formula for the sum [0], and the maximum request
timeout, to calculate the initial timeout. The test case illustrates a few
examples with some default Q and N values.
Because we don't want the timeout value to be too low, since it takes time to
open shards, and we don't want to quickly cycle through a few initial shards
and discard the results, the minimum inital timeout is clipped to the
previously hard-coded 100 msec timeout. Unlike previously however, this minimum
value can now also be configured.
[0] https://en.wikipedia.org/wiki/Geometric_series
Fixes: https://github.com/apache/couchdb/issues/3733
Diffstat (limited to 'rel/overlay/etc/default.ini')
-rw-r--r-- | rel/overlay/etc/default.ini | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index d3710ce44..93aa1ca59 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -276,6 +276,7 @@ bind_address = 127.0.0.1 ; all_docs_concurrency = 10 ; changes_duration = ; shard_timeout_factor = 2 +; shard_timeout_min_msec = 100 ; uuid_prefix_len = 7 ; request_timeout = 60000 ; all_docs_timeout = 10000 |