Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Re: [PATCHES] S_LOCK reduced contention through backoff patch

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: ocie(at)paracel(dot)com
Cc: dg(at)illustra(dot)com, scrappy(at)hub(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: [PATCHES] S_LOCK reduced contention through backoff patch
Date: 1998-04-30 04:21:15
Message-ID: 199804300421.AAA03789@candle.pha.pa.us (view raw or flat)
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)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)

In response to

pgsql-hackers by date

Next:From: David GouldDate: 1998-04-30 06:24:39
Subject: Re: [HACKERS] removing the exec() from doexec()
Previous:From: ocieDate: 1998-04-30 03:51:58
Subject: Re: [HACKERS] Re: [PATCHES] S_LOCK reduced contention through backoff patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group