Giter Club home page Giter Club logo

emr-autoscaling's Introduction

Description

Scale your AWS Elastic MapReduce Cluster by automatically adding or removing Task Instances. Every 5 minutes an AWS Cloudwatch Rule triggers an AWS Lambda Function which checks AWS Cloudwatch Metrics to decide whether to scale up or down.

Scaling Rules

Scaling is only initiated when no scaling is currently in progress. In addition downscaling is not performed during office hours. Apart from that the following rules are used to decide whether to scale or not.

  • scaling up
    • at least 1 YARN container has been pending during the past 5 minutes
    • at least 1 task instance group is not running its maximum of configured instances
  • scaling down
    • average memory consumption by YARN is below a given threshold for the last hour
    • at least 1 task instance group is running above its minimum of configured instances
    • the current time is not in office hours on a week day

Instance Group Selection

Currently only task instance groups are eligible for scaling and only those with a spot bid price. If the cluster has more than one task instance group it sorts all groups by their bid price in descending order and then selects the first eligible group for scaling.

Build

This project is built using Make. To setup your build environment simply do the following:

make setup-environment

To perform tests, execute

make test

To perform a build, i.e. execute unit tests and package the zip file for AWS Lambda:

make package

If you are getting an error in build due AWS region like this:

autoscaling/venv/lib/python3.9/site-packages/botocore/regions.py", line 148, in _endpoint_for_partition
    raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.

Please, configure a default region for your AWS CLI using the command aws configure and follow the steps. Currently, the default region is eu-west-1.

Deployment to AWS

Committing changes triggers a Jenkins build

Link to the Jenkins build

Parameters

The Function takes 2 sets of parameters:

Mandatory Parameters

  • emrJobFlowId
    • ID of the EMR cluster which is to be scaled

Optional Parameters

  • emrDownScalingMemoryAllocationThreshold
    • when the average memory consumption by YARN drops below this value a downscaling is triggered
    • floating point in range [0.0, 1.0]
    • defaults to 0.6
  • emrScalingMinInstances
    • minimum number of instances that has to be kept for each task instance group
    • integer >= 0
    • defaults to 0
  • emrScalingMaxInstances
    • maximum number of instances that is allowed for each task instance group
    • integer >= 0
    • defaults to 20
  • officeHoursStart
    • begin of office hour range during which no downscaling will be initiated
    • integer between 0 and 24
    • defaults to 8
  • officeHoursEnd
    • end of office hour range during which no downscaling will be initiated
    • integer between 0 and 24
    • defaults to 18

emr-autoscaling's People

Contributors

apelivan avatar christiandietze avatar fredrhaetw avatar jincejames avatar mehdi-bendriss avatar muhammadshaker avatar oli99sc avatar yogur avatar

Stargazers

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

Watchers

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

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.