Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-12-23 Thread Andres Freund
On 2014-12-23 16:42:41 -0500, Robert Haas wrote: I don't think I have anything to say about the substance of the patch. If fetch-and-add is faster than a spinlock cycle, then it is. And it's good to be fast. I don't think the primary advantage is that it's fast (even though it should be as

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-12-10 Thread Robert Haas
On Mon, Dec 8, 2014 at 2:51 PM, Andres Freund and...@2ndquadrant.com wrote: On 2014-10-30 07:55:08 -0400, Robert Haas wrote: On Wed, Oct 29, 2014 at 3:09 PM, Andres Freund and...@2ndquadrant.com wrote: But if it is, then how about adding a flag that is 4 bytes wide or less alongside

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-12-08 Thread Andres Freund
On 2014-10-30 07:55:08 -0400, Robert Haas wrote: On Wed, Oct 29, 2014 at 3:09 PM, Andres Freund and...@2ndquadrant.com wrote: But if it is, then how about adding a flag that is 4 bytes wide or less alongside bgwriterLatch, and just checking the flag instead of checking bgwriterLatch itself?

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-10-31 Thread Amit Kapila
On Thu, Oct 30, 2014 at 5:01 PM, Andres Freund and...@2ndquadrant.com wrote: On 2014-10-30 10:23:56 +0530, Amit Kapila wrote: I have a feeling that this might also have some regression at higher loads (like scale_factor = 5000, shared_buffers = 8GB, client_count = 128, 256) for the similar

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-10-30 Thread Andres Freund
On 2014-10-30 10:23:56 +0530, Amit Kapila wrote: I have a feeling that this might also have some regression at higher loads (like scale_factor = 5000, shared_buffers = 8GB, client_count = 128, 256) for the similar reasons as bgreclaimer patch, means although both reduces contention around spin

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-10-30 Thread Robert Haas
On Wed, Oct 29, 2014 at 3:09 PM, Andres Freund and...@2ndquadrant.com wrote: But if it is, then how about adding a flag that is 4 bytes wide or less alongside bgwriterLatch, and just checking the flag instead of checking bgwriterLatch itself? Yea, that'd be nicer. I didn't do it because it

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-10-29 Thread Robert Haas
On Mon, Oct 27, 2014 at 9:32 AM, Andres Freund and...@2ndquadrant.com wrote: I've previously posted a patch at http://archives.postgresql.org/message-id/20141010160020.GG6670%40alap3.anarazel.de that reduces contention in StrategyGetBuffer() by making the clock sweep lockless. Robert asked me

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-10-29 Thread Andres Freund
On 2014-10-29 14:18:33 -0400, Robert Haas wrote: On Mon, Oct 27, 2014 at 9:32 AM, Andres Freund and...@2ndquadrant.com wrote: I've previously posted a patch at http://archives.postgresql.org/message-id/20141010160020.GG6670%40alap3.anarazel.de that reduces contention in StrategyGetBuffer()

Re: [HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-10-29 Thread Amit Kapila
On Thu, Oct 30, 2014 at 12:39 AM, Andres Freund and...@2ndquadrant.com wrote: On 2014-10-29 14:18:33 -0400, Robert Haas wrote: The interaction between this and the bgreclaimer idea is interesting. We can't making popping the freelist lockless without somehow dealing with the resulting

[HACKERS] Lockless StrategyGetBuffer() clock sweep

2014-10-27 Thread Andres Freund
Hi, I've previously posted a patch at http://archives.postgresql.org/message-id/20141010160020.GG6670%40alap3.anarazel.de that reduces contention in StrategyGetBuffer() by making the clock sweep lockless. Robert asked me to post it to a new thread; I originally wrote it to see some other