Skip to content

redis-field-engineering/redis-cloud-autoscaler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redis Cloud Autoscaler

The Redis Cloud Autoscaler helps you to scale your Redis Cloud instances to new Memory / throughput limits based on current usage or a pre-set schedule.

Architecture Overview

Redis Cloud Autoscaler Architecture

The Redis Cloud Autoscaler is and application designed to run in your own environment, it will scale your Redis Cloud in / out based one of two trigger types

  1. Prometheus Alerts You can configure your Prometheus Alert Manager ot send webhook alerts to the Redis Cloud Autoscaler, the Autoscaler’s rule-based scaling system will then scale your Redis Cloud instance out / in based off of the alerts it receives.

  2. Scheduled Scaling You can configure the Redis Cloud Autoscaler to scale your Redis Cloud instance out / in based on a schedule you define.

Configuration

Redis Cloud Autoscaler Config Items

Name Description

REDIS_HOST_AND_PORT

The private endpoint of the Redis Cloud subscription database.

REDIS_PASSWORD

The password for accessing the Redis Cloud database.

REDIS_CLOUD_API_KEY

The API key for interacting with Redis Cloud services.

REDIS_CLOUD_ACCOUNT_KEY

The account key for authenticating with Redis Cloud.

REDIS_CLOUD_SUBSCRIPTION_ID

The ID of the Redis Cloud subscription.

ALERT_MANAGER_HOST

The public IP address of the Prometheus Alert Manager instance.

ALERT_MANAGER_PORT

The port on which Alert Manager is running (default: 9093).

Defining Rules

The Redis Cloud Autoscaler uses a JSON-based rule system to define how a given Redis Cloud Database should be scaled.

Field Name Type Required Description

dbId

String

Yes

The Redis Cloud Database ID.

ruleType

String

Yes

This is the type of rule - IncreaseMemory, DecreaseMemory, IncreaseThroughput, DecreaseThroughput.

scaleType

String

Yes

The way the new scale will be calculated - Deterministic, Step, Exponential.

triggerType

String

Yes

The way a scaling operation will be triggered - webhook, scheduled.

triggerValue

cron

No

Value that triggers the scaling action - currently only pertinent for scheduled triggers, the cron expression to schedule the scaling operation.

scaleValue

double

Yes

The value used to scale the Redis Cloud instance in / out. For Exponential scaleType, this is the value to multiply by. For memory rules this is in gb, for throughput rules this is in ops/sec.

scaleCeiling

No

The limit to which the Redis Cloud instance can be scaled out to.

scaleFloor

No

The minimum limit to which the Redis Cloud instance can be scaled in to.

Sample Rules:

Rule to increase memory to 1gb for a Redis Cloud Database with ID 123456:

{
  "dbId": "123456",
  "ruleType": "IncreaseMemory",
  "scaleType": "Deterministic",
  "scaleValue": 1,
  "scaleCeiling": 1,
  "triggerType":"webhook"
}

Rule to decrease memory to 0.5gb for a Redis Cloud Database with ID 123456:

{
  "dbId": "123456",
  "ruleType": "DecreaseMemory",
  "scaleType": "Deterministic",
  "scaleValue": 0.5,
  "scaleFloor": 0.5,
  "triggerType":"webhook"
}

Rule to double the throughput for a Redis Cloud Database with ID 123456:

{
  "dbId": "123456",
  "ruleType": "IncreaseThroughput",
  "scaleType": "Exponential",
  "scaleValue": 2,
  "scaleCeiling": 100000,
  "triggerType":"webhook"
}

Rule to Scale Redis to 50gb at 7:00am every weekday:

{
  "dbId": "123456",
  "ruleType": "IncreaseMemory",
  "scaleType": "Deterministic",
  "scaleValue": 50,
  "scaleCeiling": 50,
  "triggerType":"scheduled",
  "triggerValue":"0 7 * * 1-5"
}

Rule To Scale Redis up 3 GB:

{
  "dbId": "123456",
  "ruleType": "IncreaseMemory",
  "scaleType": "Step",
  "scaleValue": 3,
  "scaleCeiling": 50,
  "triggerType":"webhook"
}

Limitations

  • The Redis Cloud Autoscaler is currently only available for Redis Cloud Pro Subscriptions

  • The Redis Cloud Autoscaler will currently only operate on Subscriptions with as single database

  • The Redis Cloud Autoscaler will currently only scale a database in (down) deterministically (Deterministic is the only valid setting for DecreaseMemory and DecreaseThroughput)

Availability

Docker

The Redis Cloud Autoscaler is available as a Docker image, you can pull the image from GitHub’s Docker registry:

docker pull ghcr.io/redis-field-engineering/redis-cloud-autoscaler:latest

Jars

You can also download the JAR file from the GitHub Releases Page

Source

You can of course also build the whole thing from source by cloning this repo and running:

./gradlew build

Quickstart

To get started with the Redis Cloud Autoscaler, you can follow the steps in the quickstart folder.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages