Thread: pg_stat_bgwriter

pg_stat_bgwriter

From
dangal
Date:
Dear I would like to share with you to see what you think about the
statistics of pg_stat_bgwriter

postgres = # select * from pg_stat_bgwriter;
 checkpoints_timed | checkpoints_req | checkpoint_write_time |
checkpoint_sync_time | buffers_checkpoint | buffers_clean | maxwritten_clean
| buffers_backend | buffers_
backend_fsync | buffers_alloc | stats_reset
------------------- + ----------------- + ------------ ----------- +
---------------------- + --------------- ----- + --------------- +
------------------ + --------- -------- + ---------
-------------- + --------------- + ------------------- ------------
               338 | 6 | 247061792 | 89418 | 2939561 | 19872289 | 54876 |
6015787 |
            0 | 710682240 | 2019-10-06 19: 25: 30.688186-03
(1 row)

postgres = # show bgwriter_delay;
 bgwriter_delay
----------------
 200ms
(1 row)

postgres = # show bgwriter_lru_maxpages;
 bgwriter_lru_maxpages
-----------------------
 100
(1 row)

postgres = # show bgwriter_lru_multiplier;
 bgwriter_lru_multiplier
-------------------------
 2
(1 row)


Do you think it should increase bgwriter_lru_maxpages due to the value of
maxwritten_clean?
Do you think it should increase bgwriter_lru_maxpages,
bgwriter_lru_multiplier, and decrease bgwriter_delay due to the value of
buffers_backend compared to buffers_alloc?
Do you think a modification is necessary?
What values ​​would you recommend?
thank you



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html



Re: pg_stat_bgwriter

From
Jeff Janes
Date:
On Mon, Oct 14, 2019 at 1:25 PM dangal <danielito.gallo@gmail.com> wrote:
Do you think it should increase bgwriter_lru_maxpages due to the value of
maxwritten_clean?

I find the background writer to be pretty unimportant these days.  If the kernel is freely accepting writes without blocking, the backends can probably write their own buffers without it being a meaningful bottleneck.  On the other hand, if the kernel is constipated, no tweaking of the background writer parameters is going to insulate the backends from that fact.  That said, I would increase bgwriter_lru_maxpages (or decrease bgwriter_delay) anyway.  It probably won't make much difference, but if it does it is more likely to help than to hurt.
 
Do you think it should increase bgwriter_lru_maxpages,
bgwriter_lru_multiplier, and decrease bgwriter_delay due to the value of
buffers_backend compared to buffers_alloc?

I don't think that that comparison is meaningful, so wouldn't make changes based on it.
 
Do you think a modification is necessary?
What values would you recommend?
thank you

If you are experiencing a problem, this is probably not the right way to investigate it.  If a particular query is slow, try EXPLAIN (ANALYZE, BUFFERS).  If lots of user-facing things are slow, try sampling "select wait_event, wait_event_type  from pg_stat_activity where backend_type='client backend';"
 

Re: pg_stat_bgwriter

From
dangal
Date:
thank you very much jeff I'll see with the team that manages the operating
system to see if they can help me with this data that you have given me



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html