Commit 94907cc
Track Jemalloc external fragmentation to bound the cache
Summary:
Currently, size-awareness isn't tracking Jemalloc external fragmentation. And a bad external fragmentation can potentially cause OOM issue.
In this diff, we utilize two Jemalloc counters `stats.allocated` and `stats.active` to track the external fragmentation:
```
external fragmentation = stats.active - stats.allocated.
```
the total active object size will be:
```
totalActiveObjSize = totalAllocatedObjSize / stats.allocated * stats.active
```
Also add two Jemalloc counters:
- `objcache.jemalloc_active_bytes`
- `objcache.jemalloc_allocated_bytes`
Reviewed By: therealgymmy, jaesoo-fb
Differential Revision: D45460371
fbshipit-source-id: 71b5bc261581d9cc0c2f914237aa3766bf54ff121 parent b2785af commit 94907cc
File tree
4 files changed
+59
-0
lines changed- cachelib/experimental/objcache2
4 files changed
+59
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
339 | 342 | | |
340 | 343 | | |
341 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
| |||
164 | 167 | | |
165 | 168 | | |
166 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
| |||
278 | 285 | | |
279 | 286 | | |
280 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
281 | 294 | | |
282 | 295 | | |
283 | 296 | | |
| |||
394 | 407 | | |
395 | 408 | | |
396 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
397 | 416 | | |
398 | 417 | | |
399 | 418 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
27 | 37 | | |
28 | 38 | | |
29 | 39 | | |
| |||
107 | 117 | | |
108 | 118 | | |
109 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
110 | 131 | | |
111 | 132 | | |
112 | 133 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
| |||
0 commit comments