Slackbot
01/17/2024, 6:12 PMDavid K
01/17/2024, 6:15 PMseb
01/17/2024, 6:17 PMDavid K
01/17/2024, 6:19 PMseb
01/17/2024, 6:21 PMLari Hotari
01/17/2024, 7:13 PMFrank Kelly
01/17/2024, 7:25 PMFrank Kelly
01/17/2024, 7:26 PMseb
01/17/2024, 7:36 PMseb
01/17/2024, 7:36 PMFrank Kelly
01/17/2024, 7:41 PMDavid K
01/17/2024, 7:45 PMseb
01/17/2024, 7:50 PMGirish Sharma
01/18/2024, 6:30 AMFrank Kelly
01/18/2024, 2:11 PMloadBalancerAutoBundleSplitEnabled: true
# Default (until Pulsar 2.10) is "org.apache.pulsar.broker.loadbalance.impl.OverloadShedder"
loadBalancerLoadSheddingStrategy: "org.apache.pulsar.broker.loadbalance.impl.ThresholdShedder"
# Need to allow Pulsar to split up namespace bundles to aid in load balancing. This value must be greater than defaultNumberOfNamespaceBundles above. (Default: 128)
loadBalancerNamespaceMaximumBundles: "256"
# Increase the frequency of load shedding (Default: 30)
loadBalancerSheddingIntervalMinutes: "1"
# Prevent the same topics from being shed and moved to other brokers more that once within this timeframe (Default: 30)
loadBalancerSheddingGracePeriodMinutes: "30"
# The broker resource usage threshold used to trigger bundle offload from broker (Default: 10)
# Smaller value so that we are more likely to balance across brokers.
loadBalancerBrokerThresholdShedderPercentage: "{{ PulsarBrokerLoadBalancerThresholdShedderPercentage }}"
# Update load balancer statistic reports more frequently (Default: 10)
loadBalancerReportUpdateThresholdPercentage: "1"
# Smaller value so that we are more likely to base balancing decision on current load rather than historical load (Default: 0.9)
loadBalancerHistoryResourcePercentage: "0.0"
# We autoscale on CPU so Pulsar's measure of load should be solely based on CPU - however it does not always work so have bandwidth as backup.
# Pulsar load balancing (shedding) is initiated if ANY of these metrics is loadBalancerBrokerThresholdShedderPercentage percent above the cluster average.
loadBalancerCPUResourceWeight: "3.0"
loadBalancerBandwithInResourceWeight: "1.0"
loadBalancerBandwithOutResourceWeight: "1.0"
loadBalancerMemoryResourceWeight: "0.0"
loadBalancerDirectMemoryResourceWeight: "0.0"
# Bundle unload minimum throughput threshold. Measures minimum to be unloaded. (Default: 10 MB)
loadBalancerBundleUnloadMinThroughputThreshold: "{{ PulsarBrokerLoadBalancerBundleUnloadMinThroughput }}"
Some notes
• Since we only use HPA scaling based on CPU then our primary weight for parameters is loadBalancerCPUResourceWeight: "3.0" The value is above 1 because we deploy Pulsar without CPU limits (to avoid throttling) and Pulsar seems to pickup NOT the CPU requests but the number of CPUs on the node - which is large.
• loadBalancerBrokerThresholdShedderPercentage is parameterized - for our smaller clusters it is 1 and for larger clusters 5 - again with the goal of doing SOME offloading but not a lot
• loadBalancerBundleUnloadMinThroughputThreshold is similarly set on a per cluster basis - smaller clusters have a lower threshold, larger clusters a larger threshold
• We care solely about current broker state (is it overloaded now) so we set loadBalancerHistoryResourcePercentage: "0.0"Frank Kelly
01/18/2024, 2:13 PMkubectl get hpa platform-pulsar-broker -o yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
.
.
spec:
behavior:
scaleDown:
policies:
- periodSeconds: 600
type: Pods
value: 1
selectPolicy: Max
stabilizationWindowSeconds: 1800
scaleUp:
policies:
- periodSeconds: 15
type: Percent
value: 100
- periodSeconds: 15
type: Pods
value: 4
selectPolicy: Max
stabilizationWindowSeconds: 60
maxReplicas: 4
metrics:
- resource:
name: cpu
target:
averageUtilization: 55
type: Utilization
type: Resource
minReplicas: 2
scaleTargetRef:
apiVersion: apps/v1
kind: StatefulSet
name: platform-pulsar-broker
Note in particular the scaleUp and scaleDown policies to help ensure we don't scale up unnecessarily (esp. on pulsar cluster creation) and we scale down slowly -it's probably too conservative so we will adjust that soonGirish Sharma
01/19/2024, 3:47 PM