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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-hackers by date

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