Giter Club home page Giter Club logo

kda-flink-app-autoscaling's Introduction


๐Ÿšจ August 30, 2023: Amazon Kinesis Data Analytics has been renamed to Amazon Managed Service for Apache Flink.


Overview

This sample is meant to help users auto-scale their Kinesis Data Analytics for Java (KDA) applications using AWS Application Autoscaling. KDA currently only supports CPU based autoscaling, and readers can use the guidance in this repo to scale their KDA applications based on other signals - such as operator throughput, for instance.

We've included guidance for both step scaling and target tracking scaling. For official documentation on AWS Application Autoscaling, please visit:

Why use Application Autoscaling?

You may be wondering: "Why use Application Autoscaling; why not just trigger a Lambda function via a CloudWatch alarm and SNS?". The main reason is that Application Autoscaling has a well defined API for specifying scaling policies and associated attributes such as cooldown periods. In addition, we can take advantage of all three scaling types included with Application Autoscaling: step scaling, target tracking scaling, and schedule-based scaling (not covered in this doc).

Application autoscaling of custom resource

AWS Application autoscaling allows users to scale in/out custom resources by specifying a custom endpoint that can be invoked by Application Autoscaling. In this example, this custom endpoint is implemented using API Gateway and an AWS Lambda function. Here's a high level flow depicting this approach:

CW Alarm => Application Autoscaling => Custom Endpoint (API GW + Lambda) => Scale KDA App

CloudFormation template

The accompanying CloudFormation template takes care of provisioning all of the above components.

Scaling logic

When invoked by Application Autoscaling, the Lambda function (written in Python) will call UpdateApplication with the desired capacity specified. In addition, it will also re-configure the alarm thresholds to take into account the current parallelism of the KDA application.

You can review the Python code for the Lambda function associated with step scaling here and for target tracking autoscaling here.

Some caveats

  1. When scaling out/in, in this sample we only update the overall parallelism; we don't adjust parallelism/KPU.
  2. When scaling occurs, the KDA app experiences downtime. Please take this into consideration when configuring the step scaling increments.
  3. Please keep in mind that the throughput of a Flink application is dependent on many factors (complexity of processing, destination throughput, etc...). The step-scaling example assumes a simple relationship between incoming record throughput and scaling. And similarly millisBehindLatest for target-tracking autoscaling.

kda-flink-app-autoscaling's People

Contributors

amazon-auto avatar karthitect avatar nicusx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kda-flink-app-autoscaling's Issues

Deployment fails due to "runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions"

When deploying the sample, Cloudformation fails with "The runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions" when creating the LambdaScaler component.

Steps to reproduce: Deploy the current template

Solution is to update it to one of the newer Python runtimes, e.g. Python 3.9.

Happy to implement the necessary changes ๐Ÿ˜Š

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.