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-04 20:45:54
Message-ID: 20241104204554.gwjvyhqvayi5ec6k@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2024-11-04 14:35:23 +0100, Costa Alexoglou wrote:
> > I don't know if Docker does anything strange here.
>
> I am not sure if this is docker specific or cgroup comes into play. 
> The measurement is implemented in docker CLI, but I would make the
> assumption that the eviction is done within the cgroup scope.

I was trying to come up with possible *causes* for the eviction.

> > A large file (or many smaller files) which is cached is deleted
>
> The increase pattern is "incremental" until the huge eviction, and
> this is my question. Couldn't also the eviction happen incrementally
> rather than 15GB of file cache evicted on an instant?

It (usually) takes longer to write a file than to delete it.

If a temporary file is slowly written and then deleted after it is no
longer needed, you would see such a "sawtooth" as your screenshots show:
While the file is written, the kernel will cache the data on the
assumption that it will be read again sometime in the near future. But
when it is deleted, the kernel knows that it can't be read again - so it
will throw away all this (now useless) data.

> Seems like this issue, or the parent one that everyone is linking to this.

That seems to be just about the way it is reported, not the behaviour.

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 Guyren Howe 2024-11-04 23:17:16 nth_value out of more than n values returns null
Previous Message Adrian Klaver 2024-11-04 20:33:42 Re: Column name beginning with underscore ("_")?