Commit 330c8a9
committed
[improve][broker] Make AvgShedder the default load shedding and placement strategy
### Motivation
The modular load manager still defaults to ThresholdShedder for shedding and
LeastLongTermMessageRate for placement. The two score brokers differently
(resource usage vs. message rate), so a bundle shed from a hot broker is
routinely placed on another hot broker and shed again. ThresholdShedder's
leader-side EMA also lags actual load by minutes, which over-unloads after
scale-outs and rolling restarts, and it never sheds towards an idle broker
unless lowerBoundarySheddingEnabled is set. AvgShedder (PIP-364) pairs the
highest and lowest loaded brokers, pre-plans the destination of every bundle
it unloads, and only acts after a gap has persisted for several consecutive
checks, which removes the shed/place mismatch and the oscillation.
### Modifications
- ServiceConfiguration, conf/broker.conf, conf/standalone.conf:
loadBalancerLoadSheddingStrategy and loadBalancerLoadPlacementStrategy
default to AvgShedder; maxUnloadPercentage defaults to 0.5 so AvgShedder
equalizes a broker pair in one cycle; loadBalancerDistributeBundlesEvenlyEnabled
defaults to false and is now documented in broker.conf, since the
per-namespace bundle-count filter runs before placement and can discard
the destination AvgShedder planned for a bundle. standalone.conf gains the
strategy keys and the AvgShedder settings it did not list.
- ModularLoadManagerImpl: strategy pairing is extracted into
createLoadBalanceStrategies(). A configuration that sets a classic shedder
(ThresholdShedder, UniformLoadShedder, OverloadShedder) while leaving the
placement strategy at the new AvgShedder default no longer fails to start:
the configured shedder is kept and placement falls back to
LeastLongTermMessageRate with a warning, preserving the previous behavior
for existing configurations. AvgShedder shedding with a different placement
strategy logs a warning that its planned destinations are not honored.
- ModularLoadManagerImplStrategyTest covers the defaults, the fallback, an
explicit classic pairing, and AvgShedder shedding with other placement.
Assisted-by: Claude Code (Opus 5)1 parent 5df2b0d commit 330c8a9
5 files changed
Lines changed: 227 additions & 33 deletions
File tree
- conf
- pulsar-broker-common/src/main/java/org/apache/pulsar/broker
- pulsar-broker/src
- main/java/org/apache/pulsar/broker/loadbalance/impl
- test/java/org/apache/pulsar/broker/loadbalance/impl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1755 | 1755 | | |
1756 | 1756 | | |
1757 | 1757 | | |
1758 | | - | |
1759 | | - | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
1760 | 1768 | | |
1761 | 1769 | | |
1762 | 1770 | | |
1763 | 1771 | | |
1764 | | - | |
1765 | | - | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
1766 | 1785 | | |
1767 | 1786 | | |
1768 | 1787 | | |
| |||
1814 | 1833 | | |
1815 | 1834 | | |
1816 | 1835 | | |
1817 | | - | |
| 1836 | + | |
1818 | 1837 | | |
1819 | 1838 | | |
1820 | 1839 | | |
| |||
1827 | 1846 | | |
1828 | 1847 | | |
1829 | 1848 | | |
1830 | | - | |
1831 | | - | |
1832 | | - | |
1833 | | - | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
1834 | 1853 | | |
1835 | 1854 | | |
1836 | 1855 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1201 | 1201 | | |
1202 | 1202 | | |
1203 | 1203 | | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
1204 | 1245 | | |
1205 | 1246 | | |
1206 | 1247 | | |
| |||
Lines changed: 24 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3028 | 3028 | | |
3029 | 3029 | | |
3030 | 3030 | | |
3031 | | - | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
3032 | 3035 | | |
3033 | | - | |
| 3036 | + | |
3034 | 3037 | | |
3035 | 3038 | | |
3036 | 3039 | | |
| |||
3041 | 3044 | | |
3042 | 3045 | | |
3043 | 3046 | | |
3044 | | - | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
3045 | 3053 | | |
3046 | 3054 | | |
3047 | | - | |
| 3055 | + | |
3048 | 3056 | | |
3049 | 3057 | | |
3050 | 3058 | | |
| |||
3087 | 3095 | | |
3088 | 3096 | | |
3089 | 3097 | | |
3090 | | - | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
3091 | 3104 | | |
3092 | | - | |
| 3105 | + | |
3093 | 3106 | | |
3094 | 3107 | | |
3095 | 3108 | | |
| |||
3194 | 3207 | | |
3195 | 3208 | | |
3196 | 3209 | | |
3197 | | - | |
3198 | | - | |
3199 | | - | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
3200 | 3214 | | |
3201 | | - | |
| 3215 | + | |
3202 | 3216 | | |
3203 | 3217 | | |
3204 | 3218 | | |
| |||
Lines changed: 47 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| |||
263 | 265 | | |
264 | 266 | | |
265 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
266 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
267 | 289 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
276 | 293 | | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
281 | 313 | | |
| 314 | + | |
282 | 315 | | |
283 | 316 | | |
284 | 317 | | |
| |||
328 | 361 | | |
329 | 362 | | |
330 | 363 | | |
331 | | - | |
| 364 | + | |
332 | 365 | | |
333 | 366 | | |
334 | 367 | | |
| |||
0 commit comments