Commit 0b02bf5f authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

engine: throttle outbound queries only when busy

resolver will always attempt to contact upstreams
known to be bad if it's not busy.
this fixes a problem on low-volume resolvers
where a short connection outage could make
resolvers deny resolving queries even after the
connection is restored
parent ef27f5fe
......@@ -29,6 +29,9 @@
#define QUERY_RATE_THRESHOLD (2 * MP_FREELIST_SIZE) /**< Nr of parallel queries considered as high rate */
* @internal These are forward decls to allow building modules with engine but without Lua.
......@@ -287,6 +287,10 @@ static struct qr_task *qr_task_create(struct worker_ctx *worker, uv_handle_t *ha
kr_resolve_begin(&task->req, &engine->resolver, answer);
worker->stats.concurrent += 1;
worker->stats.queries += 1;
/* Throttle outbound queries only when high pressure */
if (worker->stats.concurrent < QUERY_RATE_THRESHOLD) {
task->req.options |= QUERY_NO_THROTTLE;
return task;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment