Commit 060ec35
Gradually reduce defrag CPU usage when defragmentation is ineffective (redis#13752)
This PR addresses an issue where if a module does not provide a
defragmentation callback, we cannot defragment the fragmentation it
generates. However, the defragmentation process still considers a large
amount of fragmentation to be present, leading to more aggressive
defragmentation efforts that ultimately have no effect.
To mitigate this, the PR introduces a mechanism to gradually reduce the
CPU consumption for defragmentation when the defragmentation
effectiveness is poor. This occurs when the fragmentation rate drops
below 2% and the hit ratio is less than 1%, or when the fragmentation
rate increases by no more than 2%. The CPU consumption will be gradually
decreased until it reaches the minimum threshold defined by
`active-defrag-cycle-min`.
---------
Co-authored-by: oranagra <[email protected]>1 parent 810eacd commit 060ec35
2 files changed
+126
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
1024 | 1025 | | |
1025 | 1026 | | |
1026 | 1027 | | |
1027 | | - | |
| 1028 | + | |
1028 | 1029 | | |
1029 | 1030 | | |
1030 | 1031 | | |
| |||
1040 | 1041 | | |
1041 | 1042 | | |
1042 | 1043 | | |
| 1044 | + | |
1043 | 1045 | | |
1044 | 1046 | | |
1045 | 1047 | | |
| |||
1068 | 1070 | | |
1069 | 1071 | | |
1070 | 1072 | | |
1071 | | - | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
1072 | 1076 | | |
1073 | 1077 | | |
1074 | 1078 | | |
| |||
1104 | 1108 | | |
1105 | 1109 | | |
1106 | 1110 | | |
1107 | | - | |
| 1111 | + | |
1108 | 1112 | | |
1109 | 1113 | | |
1110 | 1114 | | |
1111 | 1115 | | |
1112 | 1116 | | |
1113 | | - | |
| 1117 | + | |
1114 | 1118 | | |
1115 | 1119 | | |
1116 | 1120 | | |
| |||
1148 | 1152 | | |
1149 | 1153 | | |
1150 | 1154 | | |
1151 | | - | |
| 1155 | + | |
1152 | 1156 | | |
1153 | 1157 | | |
1154 | 1158 | | |
| |||
1159 | 1163 | | |
1160 | 1164 | | |
1161 | 1165 | | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
1162 | 1183 | | |
1163 | 1184 | | |
1164 | | - | |
| 1185 | + | |
1165 | 1186 | | |
1166 | 1187 | | |
1167 | 1188 | | |
1168 | 1189 | | |
1169 | 1190 | | |
1170 | 1191 | | |
1171 | 1192 | | |
1172 | | - | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1173 | 1196 | | |
1174 | 1197 | | |
1175 | 1198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
139 | 235 | | |
0 commit comments