knot-resolver icon indicating copy to clipboard operation
knot-resolver copied to clipboard

High memory consumption

Open i7an opened this issue 1 year ago • 8 comments

Hi,

I encountered some very strange behavior with knot resolver. For some reason this config causes the kresd process to bloat linearly (~10Mb / hour) and eat hundreds megabytes of memory even without any load:

cache.size = 100 * MB
cache.open(100 * MB, 'lmdb://./tmp/knot-cache')
cache.max_ttl(300)

But when I set max_ttl before opening a cache file the problem disappears and the memory footprint stays at ~17Mb:

cache.size = 100 * MB
cache.max_ttl(300)
cache.open(100 * MB, 'lmdb://./tmp/knot-cache')

Here is the docker file I used:

Dockerfile
FROM debian:11-slim

RUN apt update
RUN apt install -y wget

RUN wget https://secure.nic.cz/files/knot-resolver/knot-resolver-release.deb
RUN dpkg -i knot-resolver-release.deb
RUN apt update
RUN apt install -y knot-resolver

COPY config/knot-resolver/kresd.conf /etc/knot-resolver/kresd.conf

ENTRYPOINT ["kresd"]
CMD ["-c", "/etc/knot-resolver/kresd.conf", "-n"]

I would be grateful for any ideas and debug suggestions.

UPD Apparently the lower max_ttl the quicker RAM is consumed. Calling cache.clear() does nothing. Running kres-cache-gc does nothing.

i7an avatar Jun 19 '23 20:06 i7an