Skip to content
Snippets Groups Projects
Commit b4f41ea2 authored by Marek Vavruša's avatar Marek Vavruša Committed by Marek Vavruša
Browse files

daemon/worker: smaller starting mempool per request (16k)

an average request from cache requires ~12k, an average iterative request 16-64k
this reduces allocation cost when there are now pools on the freelist
parent 6d887f54
Branches
Tags
No related merge requests found
......@@ -27,7 +27,7 @@
#define MP_FREELIST_SIZE 32 /**< Maximum length of the worker mempool freelist */
#endif
#ifndef RECVMMSG_BATCH
#define RECVMMSG_BATCH 8
#define RECVMMSG_BATCH 5
#endif
/*
......
......@@ -52,7 +52,7 @@ static inline struct ioreq *ioreq_take(struct worker_ctx *worker)
static inline void ioreq_release(struct worker_ctx *worker, struct ioreq *req)
{
if (!req || worker->ioreqs.len < MP_FREELIST_SIZE) {
if (!req || worker->ioreqs.len < 4 * MP_FREELIST_SIZE) {
array_push(worker->ioreqs, req);
} else {
free(req);
......@@ -108,7 +108,7 @@ static struct qr_task *qr_task_create(struct worker_ctx *worker, uv_handle_t *ha
pool.ctx = array_tail(worker->pools);
array_pop(worker->pools);
} else { /* No mempool on the freelist, create new one */
pool.ctx = mp_new (20 * CPU_PAGE_SIZE);
pool.ctx = mp_new (4 * CPU_PAGE_SIZE);
}
/* Create worker task */
......@@ -132,6 +132,9 @@ static struct qr_task *qr_task_create(struct worker_ctx *worker, uv_handle_t *ha
answer_max = KNOT_WIRE_MAX_PKTSIZE;
} else if (knot_pkt_has_edns(query)) { /* EDNS */
answer_max = knot_edns_get_payload(query->opt_rr);
if (answer_max < KNOT_WIRE_MIN_PKTSIZE) {
answer_max = KNOT_WIRE_MIN_PKTSIZE;
}
}
/* How much space do we need for intermediate packets? */
size_t pktbuf_max = KNOT_EDNS_MAX_UDP_PAYLOAD;
......
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