Re: RFC: replace pg_stat_activity.waiting with something more descriptive

From: Vladimir Borodin <root(at)simply(dot)name>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Александр Коротков <aekorotkov(at)gmail(dot)com>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Date: 2015-09-14 07:33:08
Message-ID: 9A99C2A7-1760-419F-BDC9-A2CF99ECD694@simply.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> 12 сент. 2015 г., в 14:05, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> написал(а):
>
> On Thu, Aug 6, 2015 at 3:31 PM, Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru <mailto:i(dot)kurbangaliev(at)postgrespro(dot)ru>> wrote:
> >
> > On 08/05/2015 09:33 PM, Robert Haas wrote:
> >>
> >>
> >> You're missing the point. Those multi-byte fields have additional
> >> synchronization requirements, as I explained in some detail in my
> >> previous email. You can't just wave that away.
> >
> > I see that now. Thank you for the point.
> >
> > I've looked deeper and I found PgBackendStatus to be not a suitable
> > place for keeping information about low level waits. Really, PgBackendStatus
> > is used to track high level information about backend. This is why auxiliary
> > processes don't have PgBackendStatus, because they don't have such information
> > to expose. But when we come to the low level wait events then auxiliary
> > processes are as useful for monitoring as backends are. WAL writer,
> > checkpointer, bgwriter etc are using LWLocks as well. This is certainly unclear
> > why they can't be monitored.
> >
>
> I think the chances of background processes stuck in LWLock is quite less
> as compare to backends as they do the activities periodically. As an example
> WALWriter will take WALWriteLock to write the WAL, but actually there will never
> be any much contention for WALWriter. In synchronous_commit = on, the
> backends themselves write the WAL so WALWriter won't do much in that
> case and for synchronous_commit = off, backends won't write the WAL so
> WALWriter won't face any contention unless some buffers have to be written
> by bgwriter or checkpoint for which WAL is not flushed which I don't think
> would lead to any contention.

WALWriter is not a good example, IMHO. And monitoring LWLocks is not the only thing that waits monitoring brings to us. Here [0] is an example when understanding of what is happening inside the startup process took some long time and led to GDB usage. With waits monitoring I could do a couple of SELECTs and use oid2name to understand the reason of a problem.

Also we should consider that PostgreSQL has a good infrastructure to parallelize many auxilary processes. Can we be sure that we will always have exactly one wal writer process? Perhaps, some time in the future we would need several of them and there would be contention for WALWriteLock between them. Perhaps, wal writer is not a good example here too, but having multiple checkpointer or bgwriter processes on the near future seems very likely, no?

[0] http://www.postgresql.org/message-id/FE82A9A7-0D52-41B5-A9ED-967F6927CB8A@simply.name <http://www.postgresql.org/message-id/FE82A9A7-0D52-41B5-A9ED-967F6927CB8A@simply.name>
>
> I am not denying from the fact that there could be some contention in rare
> scenarios for background processes, but I think tracking them is not as
> important as tracking the LWLocks for backends.
>
> Also as we are planning to track the wait_event information in pg_stat_activity
> along with other backends information, it will not make sense to include
> information about backend processes in this variable as pg_stat_activity
> just displays information of backend processes.
>
> With Regards,
> Amit Kapila.
> EnterpriseDB: http://www.enterprisedb.com <http://www.enterprisedb.com/>

--
May the force be with you…
https://simply.name

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2015-09-14 07:35:50 Re: PATCH: index-only scans with partial indexes
Previous Message Noah Misch 2015-09-14 07:29:16 row_security GUC, BYPASSRLS