| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com> |
| Cc: | Quan Zongliang <quanzongliang(at)yeah(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: log_postmaster_stats |
| Date: | 2026-11-20 16:20:27 |
| Message-ID: | CA+TgmoZebU=5oa-eLdbBJULzXrMzw=cneCiuVEW8nPW83XuMXw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Sorry for the lengthy delay in responding.
On Thu, Jul 30, 2026 at 2:46 AM Jakub Wartak
<jakub(dot)wartak(at)enterprisedb(dot)com> wrote:
> > I suspect the right thing to do here is drop all the CPU usage stuff
> > and just make it a test for whether the connection rate is high. Then
> > you could also make the value of the parameter an integer, like:
> > log_excessive_connection_rate=100 to log whenever there are >=100
> > connection in 1 second. That gives the parameter a very specific
> > charter that is easy to guess even from just looking at the name. A
> > side benefit of this is that you could write a test that would pass
> > reliably; just set log_excessive_connection_rate=1 and try to connect.
> > 1 >= 1 so a message should appear.
>
> The problem with just the raw new sessions/s is that how the user is
> supposed to know to which value set it to? She/he could observe
> rate of pg_stat_database.{sessions,parallel_workers_launched}, and based
> to come up with average and then set it up to some value.
Well, that's a problem, but your CPU-based version isn't better in
that regard. It thinks anything above 75% CPU usage within a single
second is too much, and it's not configurable at all. If my proposed
configuration knob is hard to tune, yours has no option to tune
anything. I don't think that can be better.
Also, my experience is that people who monitor for high CPU usage
often find it, but the false-positive rate tends to be very high. When
people say "oh no, my server has high CPU consumption!" my gut
reaction is "what do you think CPUs are for? did you pay for them so
they could sit idle?". This isn't quite the same, because you're not
measuring system-wide CPU usage but the postmaster specifically, and
we know 100% is a hard ceiling, and not a very high one in 2026. But
at the same time, my guess is that if we install something like this
it will find various ways of going off, at least occasionally, that
are not indicative of a real problem, or that are not indicative of
connection overload. And whether they are or not, nobody will know
after the fact whether it was a real problem or an imaginary one.
Hypothetically speaking, if an EDB customer finds 35 instances of this
log message in their postgres log over a week, what are you going to
tell them? There's nothing actionable there: you can't find out why it
happened, you can't prevent it from happening, and you don't know
whether anything is actually wrong.
> described). With CPU usage, I think people would agree that anything
> >=70-80% is clear sign of overload (so that's just nice on/off toggle).
To be absolutely clear, I do not agree with that and strongly suspect
it isn't generally true.
--
Robert Haas
Databricks
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Tristan Partin | 2026-11-20 15:59:57 | Re: compiler attribute alloc_size |