Re: [HACKERS] Re: [PATCHES] S_LOCK reduced contention through backoff patch - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Re: [PATCHES] S_LOCK reduced contention through backoff patch
Date
Msg-id 199804300421.AAA03789@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: [PATCHES] S_LOCK reduced contention through backoff patch  (ocie@paracel.com)
List pgsql-hackers
>
> David Gould wrote:
>
> [snip]
> > Here is the Spinlock back off patch I promised. This does semi-random
> > backoff using select() to lessen throughput degradation due to spinlock
> > contention with large numbers of runnable backends.
>
> Does this actually use some sort of random number generator?  I'm
> thinking that this may not be entirely necessary.  With Ethernet, this
> is needed to avoid another colission, but with locks, one process is
> guaranteed to get a lock.

From the patch.  Looks very good to me.

!  * Each time we busy spin we select the next element of this array as the
!  * number of microseconds to wait. This accomplishes pseudo random back-off.
!  * Values are not critical and are weighted to the low end of the range. They
!  * were chosen to work even with different select() timer resolutions on
!  * different platforms.
!  * note: total time to cycle through all 16 entries might be about .1 second.
!  */
! int                   s_spincycle[S_NSPINCYCLE] =
! {0, 0, 0, 1000, 5000, 0, 10000, 3000,
!  0, 10000, 0, 15000, 9000, 21000, 6000, 30000
! };

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: ocie@paracel.com
Date:
Subject: Re: [HACKERS] Re: [PATCHES] S_LOCK reduced contention through backoff patch
Next
From: dg@illustra.com (David Gould)
Date:
Subject: Re: [HACKERS] removing the exec() from doexec()