Overview of Auto-Scaling
One of the significant challenges faced by organizations dealing with real-time data is ensuring that the underlying infrastructure can handle varying workloads. Traditional scaling methods often involve manual intervention, leading to inefficiency, and increased operational costs. Private Cloud Auto-Scaling addresses these challenges by providing an intelligent, automated solution. The Power of Private Cloud Auto-Scaling:- Dynamic Resource Allocation: Private Cloud Auto-Scaling dynamically adjusts resources based on the incoming workload. Whether it’s handling a sudden spike in traffic or scaling down during periods of low activity, Pulsar ensures optimal resource utilization, leading to cost savings and improved performance.
- Efficient Load Balancing: Auto-Scaling in Pulsar ensures that the message processing load is evenly distributed across brokers. This prevents any single broker from becoming a bottleneck, allowing the system to maintain high throughput and low latency even under heavy loads.
- Cost-Effective Scaling: Traditional scaling methods often result in over-provisioning to handle peak loads, leading to unnecessary costs. Private Cloud Auto-Scaling optimizes resource allocation, ensuring that organizations pay only for the resources they need, making it a cost-effective solution for real-time data processing.
Auto-Scaling with resource metrics
Prerequisites
Private Cloud Auto-Scaling by default uses resource metrics for Pod scaling which requires the Kubernetes Metrics Server to provide metrics.- Deploy the Metrics Server with the following command:
- Verify that the metrics-server deployment is running
Enable Auto-Scaling with resource metrics
Private Cloud Auto-Scaling has default scaling policy basd on cpu Utilization asspec.autoScalingPolicy
field on PulsarBroker
CR and PulsarProxy
CR:
Auto-Scaling with custom metrics
Private Cloud Auto-Scaling supports configuring scaling policy based on custom metrics and multiple metrics to cover more complex scenario.Prerequisites
To use the custom metrics Auto-Scaling, we need to install the Prometheus and Prometheus Adapter to provide metrics.- Create Kubernetes namespace for Promtheus and Prometheus Adapter:
- Add
prometheus-community
Helm repo
- Install the Prometheus chart
- Preapre a values config
sample-config.yaml
for Prometheus Adapter chart
- Install the Prometheus Adapter chart
Enable Auto-Scaling with custom metrics
After installing the Promtheus and Prometheus Adapter, you can configure to use custom metrics at thespec.autoScalingPolicy.metrics
:
cpu_usage
, network_in_rate_kb
and network_out_rate_kb
for Auto-Scaling.
To customize the scaling policy for Auto-Scaling, you can configure at the spec.autoScalingPolicy.behavior:
:
- [1]
scaleDown
: Define the behavior while scaling down. - [2]
scaleUp
: Define the behavior while scaling up. - [3]
stabilizationWindowSeconds
: Stabilization window is used to restrict the flapping of replica count when the metrics used for scaling keep fluctuating. - [4]
policies
: Define the scaling policy, you can limit the scaling number or percent in theperiodSeconds
.