Re: Adjustment of spinlock sleep delays
От | Tom Lane |
---|---|
Тема | Re: Adjustment of spinlock sleep delays |
Дата | |
Msg-id | 13987.1060124527@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Adjustment of spinlock sleep delays (Rod Taylor <rbt@rbt.ca>) |
Ответы |
Re: Adjustment of spinlock sleep delays
|
Список | pgsql-hackers |
Rod Taylor <rbt@rbt.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 = 10msecelse 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
В списке pgsql-hackers по дате отправления: