Index: trunk/phase3/includes/PoolCounter.php |
— | — | @@ -4,9 +4,14 @@ |
5 | 5 | * When you have many workers (threads/servers) giving service, and a |
6 | 6 | * cached item expensive to produce expires, you may get several workers |
7 | 7 | * doing the job at the same time. |
| 8 | + * |
8 | 9 | * Given enough requests and the item expiring fast (non-cacheable, |
9 | 10 | * lots of edits...) that single work can end up unfairly using most (all) |
10 | | - * of the cpu of the pool. This is also known as 'Michael Jackson effect'. |
| 11 | + * of the cpu of the pool. This is also known as 'Michael Jackson effect' |
| 12 | + * since this effect triggered on the english wikipedia on the day Michael |
| 13 | + * Jackson died, the biographical article got hit with several edits per |
| 14 | + * minutes and hundreds of read hits. |
| 15 | + * |
11 | 16 | * The PoolCounter provides semaphore semantics for restricting the number |
12 | 17 | * of workers that may be concurrently performing such single task. |
13 | 18 | * |
— | — | @@ -16,15 +21,15 @@ |
17 | 22 | abstract class PoolCounter { |
18 | 23 | |
19 | 24 | /* Return codes */ |
20 | | - const LOCKED = 1; /* Lock acquired */ |
| 25 | + const LOCKED = 1; /* Lock acquired */ |
21 | 26 | const RELEASED = 2; /* Lock released */ |
22 | | - const DONE = 3; /* Another one did the work for you */ |
| 27 | + const DONE = 3; /* Another worker did the work for you */ |
23 | 28 | |
24 | | - const ERROR = -1; /* Indeterminate error */ |
25 | | - const NOT_LOCKED = -2; /* Called release() with no lock held */ |
26 | | - const QUEUE_FULL = -3; /* There are already maxqueue workers on this lock */ |
27 | | - const TIMEOUT = -4; /* Timeout exceeded */ |
28 | | - const LOCK_HELD = -5; /* Cannot acquire another lock while you have one lock held */ |
| 29 | + const ERROR = -1; /* Indeterminate error */ |
| 30 | + const NOT_LOCKED = -2; /* Called release() with no lock held */ |
| 31 | + const QUEUE_FULL = -3; /* There are already maxqueue workers on this lock */ |
| 32 | + const TIMEOUT = -4; /* Timeout exceeded */ |
| 33 | + const LOCK_HELD = -5; /* Cannot acquire another lock while you have one lock held */ |
29 | 34 | |
30 | 35 | /** |
31 | 36 | * I want to do this task and I need to do it myself. |