Introduction to Event Driven Auto Scaling
Before understanding Event-Driven Auto Scaling, take a look at what Event-Driven Architecture is.
Event-Driven Architecture
Event-Driven Architecture(EDA) is a higher-level application design paradigm that specifies how your app's many components interact with one another and with other external apps.Events, event emitters, event managers, and event consumers are all terms used to describe interactions.
In EDA, Information Exchange between the components happens through the production and consumption of events.
What is an Event?
Decoupling producers and consumers
The modification of some entity's status is commonly associated with events. For example, placing an order is an event on an e-commerce platform.
The event-driven architecture enables a logical separation between producers and consumers. With this separation, the producer and consumer don't need to worry about each other.
The events that producers produce will be consumed, so they need not worry about how consumers will receive them.
Consumers don't need to worry about the producers and how the events were produced.
For example, if you are booking a taxi you will be the producer of that event(booking a taxi) the taxi driver who accepts your request is a consumer of the event.
Push based mechanism
Before we understand push based mechanism, let us first understand the difference between polling-based and push based mechanisms.
For instance, if any product is out of stock on an e-commerce platform, some people keep refreshing the website every few minutes to check the status of that particular product, this scenario is like a Polling-based mechanism. While few others activate the notify option and when the stock is back they will be notified, this scenario is push based mechanism.
Event-driven systems are a more modern approach to push based mechanism. The consumer doesn't need constant polling because events will notify them when something happens in their system - this is useful for real-time data transformation and analysis.
Event-Driven Auto Scaling
Event-driven auto scaling is a great way to ensure that your service can handle increasing workloads. Based on the number of events that need to be processed, you can ensure that your service can keep up with demand. This type of scaling is beneficial for services that receive many requests without any prior information.
Event-Driven Auto scaling on Kubernetes
The Horizontal Pod Autoscaler (HPA) in Kubernetes only reacts to resource-based metrics such as CPU or memory usage. For event-driven applications where there could suddenly be a stream of data, this can take time and cause delays in scaling up, plus you have the extra hassle of removing pods when the stream becomes slower than expected!
Is there any component that can do the EDA job on Kubernetes? Luckily Yes, We have KEDA.
KEDA - Kubernetes Event-Driven Autoscaling
KEDA is a lightweight and easy-to-use event-driven autoscaler for Kubernetes. Event-driven scaling means that KEDA will automatically scale your pods up or down based on how many events they are processing. KEDA works with standard components like horizontal pod autoscaler (HPA).
The following article will be on KEDA hands-on. Keep an eye on this space.