pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Ants Aasma <ants@cybertec.at>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Tharakan, Robins <tharar@amazon.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: track_planning causing performance regression
Date: Tue, 30 Jun 2020 22:40:09 +0900
Message-ID: <fdda5b0a-b433-b162-97ca-2093dacd40ec@oss.nttdata.com> (raw)
In-Reply-To: <CANwKhkPUBcSBMwR1=dgGe-7cZriQ=Rge4j_xv5wHni+YM_CgSA@mail.gmail.com>
References: <2895b53b033c47ccb22972b589050dd9@EX13D05UWC001.ant.amazon.com>
	<CAOBaU_ZNAjSQEdWK9ERsv6zqhdRqB_C0dVv97BrKETV4Rv7gig@mail.gmail.com>
	<d4a15deb-8a85-b78c-b447-bc5df7c4a926@oss.nttdata.com>
	<CAOBaU_awkSmyBxUXZLfH0DrogqeXd6W8TBmLpF7f--RrxPRy9A@mail.gmail.com>
	<CANwKhkPvU2oUR5c76mDEASz+-9Y2YSqHYvj2f80_CAZp7dEbXg@mail.gmail.com>
	<5725cc95-6aea-d3a8-6ea5-36acf780a55d@oss.nttdata.com>
	<CANwKhkPUBcSBMwR1=dgGe-7cZriQ=Rge4j_xv5wHni+YM_CgSA@mail.gmail.com>



On 2020/06/30 20:30, Ants Aasma wrote:
> On Tue, 30 Jun 2020 at 08:43, Fujii Masao <masao.fujii@oss.nttdata.com <mailto:masao.fujii@oss.nttdata.com>> wrote:
> 
>      > The problem looks to be that spinlocks are terrible with overloaded CPU and a contended spinlock. A process holding the spinlock might easily get scheduled out leading to excessive spinning by everybody. I think a simple thing to try would be to replace the spinlock with LWLock.
> 
>     Yes. Attached is the POC patch that replaces per-counter spinlock with LWLock.
> 
> 
> Great. I think this is the one that should get considered for testing.
> 
>      > I did a prototype patch that replaces spinlocks with futexes, but was not able to find a workload where it mattered.
> 
>     I'm not familiar with futex, but could you tell me why you used futex instead
>     of LWLock that we already have? Is futex portable?
> 
> 
> Futex is a Linux kernel call that allows to build a lock that has uncontended cases work fully in user space almost exactly like a spinlock, while falling back to syscalls that wait for wakeup in case of contention. It's not portable, but probably something similar could be implemented for other operating systems. I did not pursue this further because it became apparent that every performance critical spinlock had already been removed.
> 
> To be clear, I am not advocating for this patch to get included. I just had the patch immediately available and it could have confirmed that using a better lock fixes things.

Understood. Thanks for the explanation!

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (64+ messages)  latest in thread

Message-ID: <fdda5b0a-b433-b162-97ca-2093dacd40ec@oss.nttdata.com>
Permalink:  ../fdda5b0a-b433-b162-97ca-2093dacd40ec@oss.nttdata.com/
Also on:    postgresql.org/message-id/fdda5b0a-b433-b162-97ca-2093dacd40ec@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, ants@cybertec.at, rjuju123@gmail.com, tharar@amazon.com
  Subject: Re: track_planning causing performance regression
  In-Reply-To: <fdda5b0a-b433-b162-97ca-2093dacd40ec@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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