Re: Used memory calculation in containers - docker stats and file cache

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Used memory calculation in containers - docker stats and file cache
Date: 2024-11-01 19:56:17
Message-ID: 20241101195617.xkexgtwuyeo2hvmx@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2024-10-27 16:23:44 +0100, Costa Alexoglou wrote:
> The container limit was 16GB of RAM, and as soon as this limit was reached,
> there was no restart or OOM errors, rather than a huge drop in memory (image
> `ContainerRelativeAbsolute`).
[...]
> 2. What is happening on the OS level when suddenly 15GB of file cache is
> getting erased (image `ContainerRelativeAbsolute`)? I would expect for
> incremental deletes rather than so many GB of cache being evicted.

I don't know if Docker does anything strange here. I can think of two
scenarios which would normally result in a sudden drop in filesystem
cache size:

1) A large file (or many smaller files) which is cached is deleted
2) Something else briefly needs a lot of RAM, evicting data from the
cache.

Both can happen in a database (for example, a large sort operation might
need a few GBs of either RAM or temporary files, depending on your
work_mem settings), but I wouldn't expect them to happen just before the
configured limit is reached. So I'd double check the logs if there are
any errors.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thiemo Kellner 2024-11-01 20:47:37 Re: Plans for partitioning of inheriting tables
Previous Message Adrian Klaver 2024-11-01 19:38:09 Re: Plans for partitioning of inheriting tables