Git Product home page Git Product logo

bosh-scaler's Introduction

BOSH AutoScaler with CF Plugin

Build Status Code Climate

Requirements

  • Ruby
  • Bundler
  • BOSH

Getting started

# Clone the repository
git clone https://github.com/nttlabs/bosh_scaler.git
cd bosh_scaler

# Create a config file
vi ./config/sample.yml

# Install required gems
bundle install

# Run
bundle exec ./bin/scaler ./config/sample.yml

Basic Configuration

See config/sample.yml for the basic configuration.

We recommend that you should create a new BOSH user such as scaler for AutoScaler with the bosh create user command so that you can filter BOSH tasks invoked by AutoScaler.

Defining Scaling Rules

You can define scaling rules in your deployment manifests.

---
deployment: cf

jobs:
  - name: router
    instances: 1
    resource_pool: medium_z1
    templates:
      - gorouter
  - name: runner
    instances: 3
    resource_pool: large_z1
    templates:
      - dea_next
      - dea_logging_agent

...snip...

scale:
  jobs:
    - name: router                            # Job name to scale
      cooldown: 300                           # seconds
      out:                                    # Scaling-out
        limit: 10                             # maximum instances
        unit: 2                               # Adds 2 instances at every event (default: 1)
        conditions:                           # Joined with OR for scaling-out
          - class: CpuAverage                 # CPU usage average
            larger_than: 80                   # Threshold (percent)
            duration: 300                     # For calculating average
          - class: MemoryAverage              # Memory usage average
            larger_than: 90                   # Threshold (percent)
            duration: 300                     # For calculating average
      in:                                     # Scaling-in
        limit: 3                              # minimum instances
        conditions:                           # Joined with AND for scaling-in
          - class: CpuAverage                 # CPU usage average
            smaller_than: 10                  # percent
            duration: 300                     # For calculating average
          - class: MemoryAverage              # Memory usage average
            smaller_than: 20                  # Threshold (percent)
            duration: 300                     # For calculating average
    - name: runner
      cooldown: 300
      out:
        limit: 20
        conditions:
          - class: CfVarzAverage              # Cloud Foundry Metrics
            varz_job: DEA                     # varz job name
            varz_key: available_memory_ratio  # varz key name
            smaller_than: 10
            duration: 300
      in:
        limit: 3
        conditions:
          - class: CfVarzAverage
            varz_job: DEA
            varz_key: available_memory_ratio
            larger_than: 80
            duration: 300

Available conditions classes

BOSH Heartbeat

  • CpuAverage
    • Average CPU percentage during duration
  • MemoryAverage
    • Avarage memory percentage during duration
  • LoadAverage1
    • Latest Load Average in 1 minute
  • LoadAverage5
    • Latest Load Average in 5 minutes
  • LoadAverage15
    • Latest Load Average in 15 minute

CF VARZ metrics

  • CfVarzAverage
    • Average CF Varz value during duration

CF Plugin

BOSH AutoScaler supports input from Cloud Foundry Collector. To use the CfVarzAverage condtion in your manifest file, send metrics to yoru AutoScaler with the TSDB historian.

Sample Collector configuration with cf-release

properties:
  collector:
    use_tsdb: true
    deployment_name: cf
  opentsdb:
    address: 192.168.15.139     # your AutoScaler address
    port: 4567                  # your AutoScaler port

Web UI

BOSH AutoScaler has a Web UI on which you can confirm loaded rules and auto scaling task log. Access http://<your_ip>:8888/ on your web brower.

Contributing

Fork the repository and send a new Pull Request with your topic branch.

bosh-scaler's People

Contributors

yudai avatar nguyendangminh avatar

Watchers

Corentin Dupont avatar James Cloos 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.