1# Historical Histogram Data
2
3This page presents data captured from `base::ThreadPool` histograms at a given
4point in time so it can be used in future design decisions.
5
6All data is 28-day aggregation on Stable channel.
7
8## Number of tasks between waits
9
10Number of tasks between two waits by a foreground worker thread in a
11browser/renderer process.
12
13Histogram name: ThreadPool.NumTasksBetweenWaits.(Browser/Renderer).Foreground
14Date: August 2019
15Values in tables below are percentiles.
16
17### Windows
18
19| Number of tasks | Browser process | Renderer process |
20|-----------------|-----------------|------------------|
21| 1               | 87              | 92               |
22| 2               | 95              | 98               |
23| 5               | 99              | 100              |
24
25### Mac
26
27| Number of tasks | Browser process | Renderer process |
28|-----------------|-----------------|------------------|
29| 1               | 81              | 90               |
30| 2               | 92              | 97               |
31| 5               | 98              | 100              |
32
33### Android
34
35| Number of tasks | Browser process | Renderer process |
36|-----------------|-----------------|------------------|
37| 1               | 92              | 96               |
38| 2               | 97              | 98               |
39| 5               | 99              | 100              |
40
41
42## Number of tasks run while queueing
43
44Number of tasks run by ThreadPool while task was queuing (from time task was
45posted until time it was run). Recorded for dummy heartbeat tasks in the
46*browser* process. The heartbeat recording avoids dependencies between this
47report and other work in the system.
48
49Histogram name: ThreadPool.NumTasksRunWhileQueuing.Browser.*
50Date: September 2019
51Values in tables below are percentiles.
52
53Note: In *renderer* processes, on all platforms/priorities, 0 tasks are run
54while queuing at 99.5th percentile.
55
56### Windows
57
58| Number of tasks | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
59|-----------------|---------------|--------------|-------------|
60| 0               | 95            | 93           | 90          |
61| 1               | 98            | 95           | 92          |
62| 2               | 99            | 96           | 93          |
63| 5               | 100           | 98           | 95          |
64
65### Mac
66
67| Number of tasks | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
68|-----------------|---------------|--------------|-------------|
69| 0               | 100           | 100          | 99          |
70| 1               | 100           | 100          | 99          |
71| 2               | 100           | 100          | 99          |
72| 5               | 100           | 100          | 100         |
73
74### Android
75
76| Number of tasks | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
77|-----------------|---------------|--------------|-------------|
78| 0               | 99            | 98           | 97          |
79| 1               | 100           | 99           | 99          |
80| 2               | 100           | 99           | 99          |
81| 5               | 100           | 100          | 100         |
82
83### Chrome OS
84
85For all priorities, 0 tasks are run while queueing at 99.5th percentile.
86
87### Analysis
88
89The number of tasks that run while a BEST_EFFORT task is queued is unexpectedly
90low. We should explore creating threads less aggressively, at the expense of
91keeping BEST_EFFORT tasks in the queue for a longer time. See
92[Bug 906079](https://crbug.com/906079).
93
94## Number of workers
95
96Number of workers that live in a given SchedulerWorkerPool. Recorded every
9759 minutes.
98
99Histogram name: ThreadPool.NumWorkers.(Browser/Renderer/ContentChild).Foreground
100Date: July 2020
101Values in tables below are percentiles.
102
103### Windows
104
105| Number of workers | Browser process | Renderer process |
106|-------------------|-----------------|------------------|
107| 2                 | 39              | 87               |
108| 5                 | 88              | 98               |
109| 10                | 98              | 100              |
110
111### Mac
112
113| Number of workers | Browser process | Renderer process |
114|-------------------|-----------------|------------------|
115| 2                 | 52              | 98               |
116| 5                 | 94              | 99               |
117| 10                | 99              | 100              |
118
119### Android
120
121| Number of workers | Browser process | Renderer process |
122|-------------------|-----------------|------------------|
123| 2                 | 30              | 84               |
124| 5                 | 80              | 89               |
125| 10                | 99              | 100              |
126
127## Number of active workers
128
129Number of workers running a task in a given SchedulerWorkerPool. Recorded
130every 59 minutes
131
132Histogram name: ThreadPool.NumActiveWorkers.(Browser/Renderer/ContentChild).Foreground
133Date: July 2020
134Values in tables below are percentiles.
135
136### Windows
137
138| Number of workers | Browser process | Renderer process |
139|-------------------|-----------------|------------------|
140| 0                 | 88.72           | 99.72            |
141| 1                 | 90.36           | 99.89            |
142| 2                 | 92.33           | 99.95            |
143| 5                 | 97.63           | 99.99            |
144
145### Mac
146
147| Number of workers | Browser process | Renderer process |
148|-------------------|-----------------|------------------|
149| 0                 | 99.21           | 99.92            |
150| 1                 | 99.85           | 99.98            |
151| 2                 | 99.94           | 99.99            |
152| 5                 | 99.99           | 100              |
153
154### Android
155
156| Number of workers | Browser process | Renderer process |
157|-------------------|-----------------|------------------|
158| 0                 | 94.18           | 99.59            |
159| 1                 | 95.66           | 99.9             |
160| 2                 | 97.85           | 99.93            |
161| 5                 | 99.50           | 99.97            |
162
163## Detach Duration
164
165Time elapsed between when a shared worker is detached and when a new shared
166worker is created. Recorded each time a shared worker is created.
167
168Histogram name: ThreadPool.DetachDuration.(Browser/Renderer).Foreground
169Date: October 2020
170
171### Windows
172
173| Percentile  | Browser process (seconds) | Renderer process (seconds) |
174|-------------|---------------------------|----------------------------|
175| 25          | 22                        | 22                         |
176| 50          | 80                        | 65                         |
177| 75          | 301                       | 209                        |
178| 95          | 3468                      | 1801                       |
179
180### Mac
181
182| Percentile  | Browser process (seconds) | Renderer process (seconds) |
183|-------------|---------------------------|----------------------------|
184| 25          | 23                        | 20                         |
185| 50          | 82                        | 57                         |
186| 75          | 285                       | 209                        |
187| 95          | 2720                      | 1665                       |
188
189### Android
190
191| Percentile  | Browser process (seconds) | Renderer process (seconds) |
192|-------------|---------------------------|----------------------------|
193| 25          | 96                        | 97                         |
194| 50          | 362                       | 418                        |
195| 75          | 1161                      | 1307                       |
196| 95          | > 1 hour                  | > 1 hour                   |
197
198## Task Latency
199
200Time elapsed between when a task is posted and when it starts to run. Recorded
201for each task that runs inside the ThreadPool.
202
203Unit: microseconds
204
205Histogram name: ThreadPool.TaskLatencyMicroseconds.(Browser/Renderer).(UserBlocking/UserVisible/Background)TaskPriority
206Date: October 13, 2020
207
208### Windows
209
210#### Browser process
211
212| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
213|------------|---------------|--------------|-------------|
214| 25         | 11            | 13           | 39          |
215| 50         | 19            | 27           | 386         |
216| 75         | 44            | 60           | 2533        |
217| 95         | 495           | 701          | > 20 ms     |
218| 99         | > 20 ms       | 16705        | > 20 ms     |
219
220Count distribution:
221- USER_BLOCKING: 14%
222- USER_VISIBLE: 72%
223- BEST_EFFORT: 14%
224
225#### Renderer process
226
227| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
228|------------|---------------|--------------|-------------|
229| 25         | 14            | 18           | 151         |
230| 50         | 30            | 39           | 567         |
231| 75         | 65            | 86           | 9145        |
232| 95         | 1102          | 2230         | > 20 ms     |
233| 99         | 7664          | > 20 ms      | > 20 ms     |
234
235Count distribution:
236- USER_BLOCKING: 45%
237- USER_VISIBLE: 54%
238- BEST_EFFORT: 0%
239
240### Mac
241
242#### Browser process
243
244| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
245|------------|---------------|--------------|-------------|
246| 25         | 15            | 15           | 1748        |
247| 50         | 28            | 32           | 4848        |
248| 75         | 99            | 90           | 12492       |
249| 95         | 2101          | 1781         | > 20 ms     |
250| 99         | 13129         | 17192        | > 20 ms     |
251
252Count distribution:
253- USER_BLOCKING: 13%
254- USER_VISIBLE: 81%
255- BEST_EFFORT: 6%
256
257#### Renderer process
258
259| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
260|------------|---------------|--------------|-------------|
261| 25         | 15            | 22           | 108         |
262| 50         | 28            | 36           | 175         |
263| 75         | 66            | 58           | 1783        |
264| 95         | 630           | 684          | > 20 ms     |
265| 99         | 3895          | 6966         | > 20 ms     |
266
267Count distribution:
268- USER_BLOCKING: 45%
269- USER_VISIBLE: 55%
270- BEST_EFFORT: 0%
271
272### Chrome OS
273
274#### Browser process
275
276| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
277|------------|---------------|--------------|-------------|
278| 25         | 38            | 23           | 17          |
279| 50         | 68            | 65           | 28          |
280| 75         | 218           | 198          | 613         |
281| 95         | 2293          | 3615         | > 20 ms     |
282| 99         | 18084         | > 20 ms      | > 20 ms     |
283
284Count distribution:
285- USER_BLOCKING: 7%
286- USER_VISIBLE: 40%
287- BEST_EFFORT: 53%
288
289#### Renderer process
290
291| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
292|------------|---------------|--------------|-------------|
293| 25         | 40            | 48           | 74          |
294| 50         | 111           | 108          | 484         |
295| 75         | 496           | 628          | > 20 ms     |
296| 95         | 5394          | 5866         | > 20 ms     |
297| 99         | > 20 ms       | > 20 ms      | > 20 ms     |
298
299Count distribution:
300- USER_BLOCKING: 68%
301- USER_VISIBLE: 32%
302- BEST_EFFORT: 0%
303
304### Android
305
306#### Browser process
307
308| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
309|------------|---------------|--------------|-------------|
310| 25         | 43            | 37           | 53          |
311| 50         | 86            | 103          | 122         |
312| 75         | 224           | 412          | 648         |
313| 95         | 1719          | > 20 ms      | > 20 ms     |
314| 99         | 10001         | > 20 ms      | > 20 ms     |
315
316Count distribution:
317- USER_BLOCKING: 58%
318- USER_VISIBLE: 39%
319- BEST_EFFORT: 4%
320
321#### Renderer process
322
323| Percentile | USER_BLOCKING | USER_VISIBLE | BEST_EFFORT |
324|------------|---------------|--------------|-------------|
325| 25         | 45            | 63           | 72          |
326| 50         | 90            | 109          | 115         |
327| 75         | 242           | 246          | 235         |
328| 95         | 1635          | 960          | 829         |
329| 99         | 6728          | 3273         | 3273        |
330
331Count distribution:
332- USER_BLOCKING: 35%
333- USER_VISIBLE: 63%
334- BEST_EFFORT: 2%
335