Earlier quoted context omitted.
AIUI in that thread they're saying "0.51x" the perf on a 96-core arm64 machine and they're also saying they cannot reproduce it on a 96-core amd64 machine. So it's not going to affect everybody both running PostgreSQL and upgrading to the latest kernel. Conditions seems to be: arm64, shitloads of core, kernel 7.0, current version of PostgreSQL. That is not going to be 100% of the installed PostgreSQL DBs out there in…
So perhaps this is a regression specifically in the arm64 code, or said differently maybe it’s a performance bug that has been there for a long time but covered up by the scheduler part that was removed?
AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
71–80 of 177 posts
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#72Once again phoronix shoot out an article without further researching nor letting the mail thread in question cool down. The follow up mails make clear that the issue is more or less a non-issue since the benchmark is wrong.
While using huge pages whenever possible is the right solution and this should be enough for PostgreSQL, perhaps there are applications that cannot use huge pages and which are affected by the regression.
So I do not think that it is right to just ignore what happened.
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#73Earlier quoted context omitted.
I'm not familiar with the jargon either, but based on some reading it comes down to how the latest kernel treats process preempts. Postgres uses spinlocks to hold shared memory for very critical processes. Spinlocks are an infinite loop with no sleep to attempt to hold a lock, thus "spinning". Previous kernels allowed spinlocking processes to run with PREEMPT_NONE. This flag tells the kernel to let the locking proces…
Why does it only appear on arm64 and not x86?
I do not know why using huge pages mitigates the regression, but it could be just because when the application uses huge pages it uses spinlocks much less frequently so the additional delays do not accumulate enough to cause a significant performance reduction.
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#74Earlier quoted context omitted.
For production Postgres, i would assume it’s close to almost no effect? If someone is running postgres in a serious backend environment, i doubt they are using Ubuntu or even touching 7.x for months (or years). It’ll be some flavor of Debian or Red Hat still on 6.x (maybe even 5?). Those same users won’t touch 7.x until there has been months of testing by distros.
A customer of mine is running on Ubuntu 22.04 and the plan is to upgrade to 26.04 in Q1 2027. We'll have to add performance regression to the plan.
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#75Can someone explain to me what's the problem? I have very little knowledge of Linux kernel, but I'm curious. I've tried reading a little, but it's jargon over jargon.
In postgres, connections are handled with a process fork, not a new thread. If such a fork first reads memory, even if it already exists, that causes a minor page fault, which goes back to the kernel so it can update memory mapping tables.
The operation under lock is only a few instructions, but if it takes longer than expected, then that causes lock contention. Regression in the kernel handling minor faults?
The whole thing is then made worse because it's a spinlock, causing all waiting processes to contend over the cpus which adds to kernel processing.
Mitigated by using huge pages, which dramatically reduces the number of mapping entries and faults. I reckon that it could also be mitigated in postgres by pre-faulting all shared memory early?
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#76Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#77Earlier quoted context omitted.
Note that it's just not a single post, and there's additional further information in following the full thread. :)
Yes, and in the following messages the conclusion was that the regression is mitigated when using huge pages.
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#78Nobody sensible runs the latest kernel; nobody running PG in production should be afraid of setting a non-default at either boot time or as a sysctl. So this will, most likely, be another step in building a PG database server (turn off pre-emption if your kernel is 7.0 or later and PG is pre-whatever-version). At worst it might become a permanent part of building a PG server and a FAQ... but if it affects one thing t…
> Nobody sensible runs the latest kernel From the article: "Linux 7.0 stable is due out in about two weeks. This is also the kernel version powering Ubuntu 26.04 LTS to be released later in April." Unfortunately, lots of people will be running it in less than a month. At the moment, it'll take a kernel patch (not a sysctl) to undo this-- hopefully something changes.
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#79I feel like using spinlocks in user space at all without kernel support like rseq is just asking for weird performance degradations.
Re: AWS engineer reports PostgreSQL perf halved by Linux 7.0, fix may not be easy
#80Earlier quoted context omitted.
That's the advantage of LTS? 24.04 is the LTS, not the one you use, 22.04.
22.04 is also an LTS release, supported for another year still. https://ubuntu.com/about/release-cycle We're just now looking at moving production machines to 24.04.
If it aint broken, don't fix it.