From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Different memory allocation strategy in Postgres 11?
Date: Tue, 30 Oct 2018 08:10:34 +0100
Message-ID: <96bfc389-120c-8e7e-b9aa-6dc70f2b03a4@gmx.net> (raw)
In-Reply-To: <CAEepm=0dQdoZTLVZ0cEA0aXUxdvpNx8iKRrtigZ8V9amvpZcvw@mail.gmail.com>
References: <pqv3nn$55o$1@blaine.gmane.org>
<CAMkU=1xedG=UBiUXtR+XMgeKdtep=9DxyOgWVMjW7QXFP3yP6g@mail.gmail.com>
<06c3eb1f-4317-4c61-1038-fbc5ec76b0fa@gmx.net>
<CAEepm=0dQdoZTLVZ0cEA0aXUxdvpNx8iKRrtigZ8V9amvpZcvw@mail.gmail.com>
Thomas Munro schrieb am 26.10.2018 um 22:13:
>>> I typically configure "shared_buffers = 4096MB" on my 16GB system as sometimes when testing, it pays off to have a bigger cache.
>>>
>>> With Postgres 10 and earlier, the Postgres process(es) would only allocate that memory from the operating system when needed.
>>> So right after startup, it would only consume several hundred MB, not the entire 4GB
>>>
>>> However with Postgres 11 I noticed that it immediately grabs the complete memory configured for shared_buffers during startup.
>>>
>>> It's not really a big deal, but I wonder if that is an intentional change or a result from something else?
>>>
>>>
>>> Do you have pg_prewarm in shared_preload_libraries?
>>
>> No. The only shared libraries are those for pg_stat_statemens
>
> Does your user have "Lock Pages in Memory" privilege? One thing that
> is new in 11 is huge AKA large page support, and the default is
> huge_pages=try. Not a Windows person myself but I believe that should
> succeed if you have that privilege and enough contiguous chunks of
> physical memory are available. If you set huge_pages=off does it
> revert to the old behaviour?
Turns out this was an "optimization" in Windows 10, and completely unrelated to Postgres.
Windows 10 has a feature called "Fast Boot" (or something along the lines).
When that is activated (which it is by default), a proper shutdown of the system does not seem to really shut it down. This is especially noteworthy with services: they don't get a shutdown event (which e.g. means even a service marked as "manual start", will still be running after a reboot if it did before)
In case of Postgres this is visible e.g. in the logfile, because there will no shutdown or startup messages.
So when I booted my laptop, Postgres continued where it was before the reboot - and the memory usage was caused caused by myself generating test data using generate_series() but I expected a "clean" state after the reboot.
When manually restarting the service everything works as expected.
Sorry for the noise.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: Different memory allocation strategy in Postgres 11?
In-Reply-To: <96bfc389-120c-8e7e-b9aa-6dc70f2b03a4@gmx.net>
References: <pqv3nn$55o$1@blaine.gmane.org> <CAMkU=1xedG=UBiUXtR+XMgeKdtep=9DxyOgWVMjW7QXFP3yP6g@mail.gmail.com> <06c3eb1f-4317-4c61-1038-fbc5ec76b0fa@gmx.net> <CAEepm=0dQdoZTLVZ0cEA0aXUxdvpNx8iKRrtigZ8V9amvpZcvw@mail.gmail.com> <96bfc389-120c-8e7e-b9aa-6dc70f2b03a4@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox