From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Rod Taylor <rbt(at)rbt(dot)ca> |
Cc: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Adjustment of spinlock sleep delays |
Date: | 2003-08-05 23:02:07 |
Message-ID: | 13987.1060124527@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Rod Taylor <rbt(at)rbt(dot)ca> writes:
> How about (round to nearest 10msec):
> time =3D oldtime + oldtime / 2 + oldtime * rand()
> while (time > 1 second)
> time =3D time - 0.80sec
> This would stagger the wakeup times, and ensure a larger number of
> retries -- but the times should be large enough after the first few
> tries (larger than 200msec) that further backoff won't be required.
But after the first few tries the sleep time would always exceed
200msec, so there would be a *maximum* of 60*5 = 300 tries before
failing --- probably a lot less, like about 120 on average.
The random component should already help to scatter the wakeups pretty
well, so I'm thinking about just
if (oldtime > 1 sec)
time = 10msec
else
time = oldtime + oldtime * rand()
ie random growth of a maximum of 2x per try, and reset to minimum delay
when you get past 1 sec. This would guarantee at least as many tries
as I'm getting currently with the deterministic algorithm (which is
effectively this if rand() always returned 1).
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Mendola Gaetano | 2003-08-05 23:03:48 | Re: logging stuff |
Previous Message | Bruce Momjian | 2003-08-05 22:56:28 | Re: logging stuff |