Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
gabbi
Product and Topic Expert
Product and Topic Expert
SAP Business Technology Platform (BTP), Kyma runtime is currently in the process of undergoing a pivotal change as it transitions to a modular architecture. This transformation will provide customers with the advantage of à la carte selection of components or capabilities, thereby reducing unnecessary overhead and complexity. One of the first modules to emerge within this novel framework is KEDA (Kubernetes Event-driven Autoscaling).

Introduction to KEDA


KEDA, an open-source initiative that facilitates event-driven autoscaling for Kubernetes workloads, was originally developed by Microsoft and Red Hat. It has since become a sandbox project under the Cloud Native Computing Foundation (CNCF). KEDA focuses on autoscaling applications in response to events sourced from a variety of platforms, including Kafka, RabbitMQ, and cloud-specific services such as Azure Service Bus and Google Pub/Sub.



The Benefits of KEDA


KEDA ushers in a new era of flexibility and efficiency in autoscaling. It enhances Kubernetes' capacity to support fine-grained autoscaling for event-driven workloads. Leveraging KEDA, you can dynamically scale your deployments from zero to any arbitrary number, contingent on the volume of events they are designed to process.



Activating the KEDA Module in SAP BTP Kyma Runtime


You can activate KEDA like any other module by adhering to the official guidelines on how to enable and disable a module.



KEDA's Cron-Based Scaler


KEDA offers a broad range of scaling strategies, one of which is the cron-based scaler. This scaler allows you to schedule scaling actions according to the time of day, an invaluable feature for managing predictable fluctuations in workload.


As an illustration, the cron-based scaler enables you to:




  • Manage High Traffic and Request Volume Peaks: With the cron-based scaler, you can program your applications to upscale during peak hours or during high-traffic events, such as Black Friday or New Year sales. The same functionality can be used to schedule your applications to upscale during off-peak hours for batch processing tasks.






  • Optimize Resource Utilization and Reduce Expenses: The cron-based scaler offers a solution to optimize resource utilization and reduce costs by allowing you to schedule your applications to downscale during non-working hours. This feature is useful for your dev/stage/QA clusters, which are not required during off-working hours.




    Note: This benefits when your workloads require more resources than the base setup. The current base setup consists of 3 VMs, each with 4 CPU and 16 GB of RAM. Therefore, if your workloads need 4 or more VMs to be provisioned, this feature can provide benefits to control costs and keep them to base setup during off-work hours.




    Note: The cron scheduling is applicable to only customer workloads and not kyma components.






How it works


The KEDA scaledobject resource can be configured with a trigger of type cron. Within the cron scaler, you can specify that the workloads should only run during working hours.



For each type of workload, you must specify scaleTargetRef.




First-hand experience


I applied the KEDA cron scaler to all custom workloads in my Kyma cluster.


All my microservices and functions replicas were scaled down to zero.



Additionally, the number of nodes (VMs) was reduced from 4 to 3.




Sample


Check out this sample on SAP-samples/kyma-runtime-extension-samples GitHub repository. In this example, KEDA cron-based scaling is applied to both a microservice and a Kyma function.

References