Commit d5d4903
Provide lock-free access to partition consumer compression providers (#689)
The compression providers map in the partition consumer is a textbook case
for using go's lock-free sync.Map: the set of map entries is stable and
access is read-only.
On machines with 4 cores or greater, read contention on the sync.RWMutex
outweighs the cost of using a sync.Map.
Below is an old article on the subject, but it still holds true today:
https://medium.com/@deckarep/the-new-kid-in-town-gos-sync-map-de24a6bf7c2c
Signed-off-by: Daniel Ferstay <dferstay@splunk.com>
Co-authored-by: Daniel Ferstay <dferstay@splunk.com>1 parent 310d480 commit d5d4903
2 files changed
Lines changed: 30 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
| 147 | + | |
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
| |||
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
174 | | - | |
| 173 | + | |
175 | 174 | | |
176 | 175 | | |
177 | 176 | | |
| |||
967 | 966 | | |
968 | 967 | | |
969 | 968 | | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
975 | 978 | | |
976 | 979 | | |
977 | 980 | | |
| |||
1192 | 1195 | | |
1193 | 1196 | | |
1194 | 1197 | | |
1195 | | - | |
1196 | | - | |
1197 | | - | |
| 1198 | + | |
1198 | 1199 | | |
1199 | | - | |
1200 | | - | |
| 1200 | + | |
| 1201 | + | |
1201 | 1202 | | |
1202 | 1203 | | |
1203 | 1204 | | |
1204 | 1205 | | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
1208 | 1218 | | |
1209 | 1219 | | |
1210 | 1220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
| 36 | + | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
| 68 | + | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | | - | |
| 100 | + | |
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
| |||
0 commit comments