pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedQuestion about buffers_alloc in pg_stat_bgwriter view for monitoring
5+ messages / 4 participants
[nested] [flat]
* Question about buffers_alloc in pg_stat_bgwriter view for monitoring
@ 2018-03-28 21:38 Alvar Freude <alvar@a-blast.org>
2018-03-29 08:30 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Gunnar "Nick" Bluth <gunnar.bluth@pro-open.de>
0 siblings, 1 reply; 5+ messages in thread
From: Alvar Freude @ 2018-03-28 21:38 UTC (permalink / raw)
To: pgsql-general
Hi all,
Can someone tell me, what the value of buffers_alloc in the pg_stat_bgwriter view (https://www.postgresql.org/docs/current/static/monitoring-stats.html#PG-STAT-BGWRITER-VIEW) is exactly? Is this the amount of shared buffers used by the bgwriter?
I’m working on a new PostgreSQL monitoring framework (https://github.com/alvar-freude/Posemo) and now look how to make reasonable checks (and as result graphs) for BGWriter activity.
At the moment my plan is to make more then one check out of pg_stat_bgwriter:
* BGWriterAmount
A check which returns the amount of written data,
taken from the following values multiplied by
current_setting('block_size'):
buffers_checkpoint, buffers_clean, buffers_backend
* BGWriterCheckpoints:
A check which returns the number of checkpoints:
checkpoints_timed + checkpoints_req
Or: checkpoints_timed, checkpoints_req
* BGWriterTime:
Time taken by the BGWriter
checkpoint_write_time, checkpoint_sync_time
* BGWriterAlloc:
Amount of memory used by BGWriter
buffers_alloc * current_setting('block_size‘)
* BGWriterInfo:
Extra values, which should go to an extra graph, because they
are much smaller and usually only increase in special situations
maxwritten_clean, buffers_backend_fsync
Is this a reasonable plan to divide pg_stat_bgwriter into this parts?
Thanks && bye
Alvar
--
Alvar C.H. Freude | http://alvar.a-blast.org/
https://blog.alvar-freude.de/
https://www.wen-waehlen.de/
Attachments:
signature.asc (application/pgp-signature, 872B) download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring
2018-03-28 21:38 Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
@ 2018-03-29 08:30 ` Gunnar "Nick" Bluth <gunnar.bluth@pro-open.de>
2018-03-29 10:50 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar C.H. Freude <alvar.freude@wen-waehlen.de>
2018-03-29 17:24 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
0 siblings, 2 replies; 5+ messages in thread
From: Gunnar \"Nick\" Bluth @ 2018-03-29 08:30 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Am 28.03.2018 um 23:38 schrieb Alvar Freude:
> Hi all,
>
> Can someone tell me, what the value of buffers_alloc in the pg_stat_bgwriter view (https://www.postgresql.org/docs/current/static/monitoring-stats.html#PG-STAT-BGWRITER-VIEW) is exactly? Is this the amount of shared buffers used by the bgwriter?
As I had to research that anyway, there's no reason not to write this
down here as well... (probably simplified, but I'm quite confident the
information is correct ;-):
Whenever a buffer is allocated, a global counter is incremented (see
"StrategyGetBuffer" in storage/buffer/freelist.c. That counter is used
by the BGWriter to determine its own wakeup/hibernate strategy, and
on-the-fly written to the global stats.
Thus, buffer_alloc is the global count of buffers allocated in the
cluster. That it appears in the bgwriter statistics is more or less
coincidental.
Best regards,
--
Gunnar "Nick" Bluth
RHCE/SCLA
Mobil +49 172 8853339
Email: gunnar.bluth@pro-open.de
_____________________________________________________________
In 1984 mainstream users were choosing VMS over UNIX.
Ten years later they are choosing Windows over UNIX.
What part of that message aren't you getting? - Tom Payne
Attachments:
signature.asc (application/pgp-signature, 472B) download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring
2018-03-28 21:38 Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
2018-03-29 08:30 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Gunnar "Nick" Bluth <gunnar.bluth@pro-open.de>
@ 2018-03-29 10:50 ` Alvar C.H. Freude <alvar.freude@wen-waehlen.de>
1 sibling, 0 replies; 5+ messages in thread
From: Alvar C.H. Freude @ 2018-03-29 10:50 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
> Am 29.03.2018 um 10:30 schrieb Gunnar Nick Bluth <gunnar.bluth@pro-open.de>:
>
> Thus, buffer_alloc is the global count of buffers allocated in the
> cluster. That it appears in the bgwriter statistics is more or less
> coincidental.
So it is the number of shared_buffers used?
This isn’t possible:
postgres=# SELECT buffers_alloc*current_setting('block_size')::numeric/1024/1024/1024, current_setting('shared_buffers') FROM pg_stat_bgwriter;
?column? | current_setting
-----------------------+-----------------
1219.7707748413085938 | 64450MB
(1 row)
About 64 GB shared buffers and 1219 used? ;-)
Or other machine:
?column? | current_setting
----------------------+-----------------
126.4642944335937500 | 64450MB
(1 row)
My Private:
?column? | current_setting
--------------------+-----------------
3.3014221191406250 | 6GB
(1 Zeile)
Ciao
Alvar
--
Alvar C.H. Freude | http://alvar.a-blast.org
https://blog.alvar-freude.de/
https://www.wen-waehlen.de/
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring
2018-03-28 21:38 Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
2018-03-29 08:30 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Gunnar "Nick" Bluth <gunnar.bluth@pro-open.de>
@ 2018-03-29 17:24 ` Alvar Freude <alvar@a-blast.org>
2018-03-30 09:50 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Achilleas Mantzios <achill@matrix.gatewaynet.com>
1 sibling, 1 reply; 5+ messages in thread
From: Alvar Freude @ 2018-03-29 17:24 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
> Am 29.03.2018 um 10:30 schrieb Gunnar Nick Bluth <gunnar.bluth@pro-open.de>:
>
> Thus, buffer_alloc is the global count of buffers allocated in the
> cluster. That it appears in the bgwriter statistics is more or less
> coincidental.
But it seems not to be the total shared_buffers used, but the total number of allocated and re-allocated buffers. So it increments every time a buffer is allocated. Maybe I’m the only one who misunderstands it – or someone with better english then me should update the docs. ;-)
postgres=# SELECT buffers_alloc*current_setting('block_size')::numeric/1024/1024/1024, current_setting('shared_buffers') FROM pg_stat_bgwriter;
?column? | current_setting
-----------------------+-----------------
1219.7707748413085938 | 64450MB
(1 row)
Or other machine:
?column? | current_setting
----------------------+-----------------
126.4642944335937500 | 64450MB
(1 row)
Small one:
?column? | current_setting
--------------------+-----------------
3.3014221191406250 | 6GB
(1 Zeile)
Ciao
Alvar
--
Alvar C.H. Freude | http://alvar.a-blast.org
https://blog.alvar-freude.de/
https://www.wen-waehlen.de/
Attachments:
signature.asc (application/pgp-signature, 872B) download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring
2018-03-28 21:38 Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
2018-03-29 08:30 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Gunnar "Nick" Bluth <gunnar.bluth@pro-open.de>
2018-03-29 17:24 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
@ 2018-03-30 09:50 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 0 replies; 5+ messages in thread
From: Achilleas Mantzios @ 2018-03-30 09:50 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 29/03/2018 20:24, Alvar Freude wrote:
> Hi,
>
>> Am 29.03.2018 um 10:30 schrieb Gunnar Nick Bluth <gunnar.bluth@pro-open.de>:
>>
>> Thus, buffer_alloc is the global count of buffers allocated in the
>> cluster. That it appears in the bgwriter statistics is more or less
>> coincidental.
> But it seems not to be the total shared_buffers used, but the total number of allocated and re-allocated buffers. So it increments every time a buffer is allocated. Maybe I’m the only one who misunderstands it – or someone with better english then me should update the docs. ;-)
>
But shared_buffers represents the max no of postgresql buffers, per server, at any given time. It is a limit (constant) not a metric. The count of all concurrent buffers at any given time must be less
than shared_buffers.
So my question is : Does buffer_alloc represent the total read/write traffic of the database since the last reset?
>
> Ciao
> Alvar
>
> --
> Alvar C.H. Freude | http://alvar.a-blast.org
> https://blog.alvar-freude.de/
> https://www.wen-waehlen.de/
--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-03-30 09:50 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 21:38 Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
2018-03-29 08:30 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Gunnar "Nick" Bluth <gunnar.bluth@pro-open.de>
2018-03-29 10:50 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar C.H. Freude <alvar.freude@wen-waehlen.de>
2018-03-29 17:24 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Alvar Freude <alvar@a-blast.org>
2018-03-30 09:50 ` Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring Achilleas Mantzios <achill@matrix.gatewaynet.com>
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