pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Different memory allocation strategy in Postgres 11?
5+ messages / 3 participants
[nested] [flat]

* Different memory allocation strategy in Postgres 11?
@ 2018-10-26 13:12  Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Thomas Kellerer @ 2018-10-26 13:12 UTC (permalink / raw)
  To: pgsql-general

I have a Postgres instance running on my Windows laptop for testing purposes. 

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? 

Regards
Thomas





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Different memory allocation strategy in Postgres 11?
@ 2018-10-26 15:42  Jeff Janes <jeff.janes@gmail.com>
  parent: Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Jeff Janes @ 2018-10-26 15:42 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-general

On Fri, Oct 26, 2018 at 9:12 AM Thomas Kellerer <spam_eater@gmx.net> wrote:

> I have a Postgres instance running on my Windows laptop for testing
> purposes.
>
> 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?

Cheers,

Jeff

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Different memory allocation strategy in Postgres 11?
@ 2018-10-26 17:10  Thomas Kellerer <spam_eater@gmx.net>
  parent: Jeff Janes <jeff.janes@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Thomas Kellerer @ 2018-10-26 17:10 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Jeff Janes schrieb am 26.10.2018 um 17:42:
>     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






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Different memory allocation strategy in Postgres 11?
@ 2018-10-26 20:13  Thomas Munro <thomas.munro@enterprisedb.com>
  parent: Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Thomas Munro @ 2018-10-26 20:13 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Sat, Oct 27, 2018 at 6:10 AM Thomas Kellerer <spam_eater@gmx.net> wrote:
> Jeff Janes schrieb am 26.10.2018 um 17:42:
> >     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?

-- 
Thomas Munro
http://www.enterprisedb.com




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Different memory allocation strategy in Postgres 11?
@ 2018-10-30 07:10  Thomas Kellerer <spam_eater@gmx.net>
  parent: Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Thomas Kellerer @ 2018-10-30 07:10 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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.



 





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2018-10-30 07:10 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 13:12 Different memory allocation strategy in Postgres 11? Thomas Kellerer <spam_eater@gmx.net>
2018-10-26 15:42 ` Jeff Janes <jeff.janes@gmail.com>
2018-10-26 17:10   ` Thomas Kellerer <spam_eater@gmx.net>
2018-10-26 20:13     ` Thomas Munro <thomas.munro@enterprisedb.com>
2018-10-30 07:10       ` Thomas Kellerer <spam_eater@gmx.net>

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