Re: [HACKERS] Should we cacheline align PGXACT? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [HACKERS] Should we cacheline align PGXACT?
Date
Msg-id 20170215192320.rgtliwgcr2cezkyw@alap3.anarazel.de
Whole thread Raw
In response to Re: [HACKERS] Should we cacheline align PGXACT?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi,

On 2017-02-15 12:24:44 -0500, Robert Haas wrote:
> If you pad PGXACT out to one cache line, you could likewise take a
> snapshot by touching 1 cache line per backend, and they'd be
> consecutive.  Maybe that difference matters to the memory prefetching
> controller, I dunno,

Unfortunately it's currently *not* consecutively accessed afaik.  We're
not iterating PGXACT sequentially, we're doing it in pgprocno order.
The reason is that otherwise we have to scan unused PGXACT entries.

I've previously played around with using actual sequential access, and
it was a good bit faster as long as nearly all connections are used -
but slower when only a few are in use, which is quite common...


> but it seems funny that we did the PGXACT work to
> reduce the number of cache lines that had to be touched in order to
> take a snapshot to improve performance, and now we're talking about
> increasing it again, also to improve performance.

I don't think it's that weird that aligning things properly is important
for performance, nor that reducing the amount of memory accessed is
beneficial.  Engineering is tradeoffs, and we might just have erred a
bit too far in this case.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] Should we cacheline align PGXACT?
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] [PROPOSAL] Temporal query processing with range types