|
| 1 | += Redis Cloud Autoscaler |
| 2 | +:linkattrs: |
| 3 | +:name: Redis Cloud Autoscaler |
| 4 | +:project-owner: redis-field-engineering |
| 5 | +:project-name: redis-cloud-autoscaler |
| 6 | +:project-group: com.redis |
| 7 | +:project-version: 0.0.1 |
| 8 | +:project-url: https://github.com/{project-owner}/{project-name} |
| 9 | +:repo-name: redis-cloud-autoscaler |
| 10 | +:imagesdir: .github/images |
| 11 | + |
| 12 | +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. |
| 13 | + |
| 14 | +== Architecture Overview |
| 15 | + |
| 16 | +image:autoscaler-architecture.png[Redis Cloud Autoscaler Architecture] |
| 17 | + |
| 18 | +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 |
| 19 | + |
| 20 | +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. |
| 21 | +2. **Scheduled Scaling** You can configure the Redis Cloud Autoscaler to scale your Redis Cloud instance out / in based on a schedule you define. |
| 22 | + |
| 23 | +=== Defining Rules |
| 24 | + |
| 25 | +The Redis Cloud Autoscaler uses a JSON-based rule system to define how a given Redis Cloud Database should be scaled. |
| 26 | + |
| 27 | +[options="header"] |
| 28 | +|=== |
| 29 | +| Field Name | Type | Required | Description |
| 30 | +| `dbId` | String | Yes | The Redis Cloud Database ID. |
| 31 | +| `ruleType` | String | Yes | This is the type of rule - `IncreaseMemory`, `DecreaseMemory`, `IncreaseThroughput`, `DecreaseThroughput`. |
| 32 | +| `scaleType` | String | Yes | The way the new scale will be calculated - `Deterministic`, `Step`, `Exponential`. |
| 33 | +| `triggerType` | String | Yes | The way a scaling operation will be triggered - `webhook`, `scheduled`. |
| 34 | +| `triggerValue` | cron | No | Value that triggers the scaling action - currently only pertinent for scheduled triggers, the cron expression to schedule the scaling operation. |
| 35 | +| `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. |
| 36 | +| `scaleCeiling` | | No | The limit to which the Redis Cloud instance can be scaled out to. |
| 37 | +| `scaleFloor` | | No | The minimum limit to which the Redis Cloud instance can be scaled in to. |
| 38 | +|=== |
| 39 | + |
| 40 | + |
| 41 | +==== Sample Rules: |
| 42 | + |
| 43 | +Rule to increase memory to 1gb for a Redis Cloud Database with ID `123456`: |
| 44 | +[source,json] |
| 45 | +---- |
| 46 | +{ |
| 47 | + "dbId": "123456", |
| 48 | + "ruleType": "IncreaseMemory", |
| 49 | + "scaleType": "Deterministic", |
| 50 | + "scaleValue": 1, |
| 51 | + "scaleCeiling": 1, |
| 52 | + "triggerType":"webhook" |
| 53 | +} |
| 54 | +---- |
| 55 | + |
| 56 | +Rule to decrease memory to 0.5gb for a Redis Cloud Database with ID `123456`: |
| 57 | +[source,json] |
| 58 | +---- |
| 59 | +{ |
| 60 | + "dbId": "123456", |
| 61 | + "ruleType": "DecreaseMemory", |
| 62 | + "scaleType": "Deterministic", |
| 63 | + "scaleValue": 0.5, |
| 64 | + "scaleFloor": 0.5, |
| 65 | + "triggerType":"webhook" |
| 66 | +} |
| 67 | +---- |
| 68 | + |
| 69 | +Rule to double the throughput for a Redis Cloud Database with ID `123456`: |
| 70 | +[source,json] |
| 71 | +---- |
| 72 | +{ |
| 73 | + "dbId": "123456", |
| 74 | + "ruleType": "IncreaseThroughput", |
| 75 | + "scaleType": "Exponential", |
| 76 | + "scaleValue": 2, |
| 77 | + "scaleCeiling": 100000, |
| 78 | + "triggerType":"webhook" |
| 79 | +} |
| 80 | +---- |
| 81 | + |
| 82 | +Rule to halve the throughput for a Redis Cloud Database with ID `123456`: |
| 83 | +[source,json] |
| 84 | +---- |
| 85 | +{ |
| 86 | + "dbId": "123456", |
| 87 | + "ruleType": "DecreaseThroughput", |
| 88 | + "scaleType": "Exponential", |
| 89 | + "scaleValue": 0.5, |
| 90 | + "scaleFloor": 1000, |
| 91 | + "triggerType":"webhook" |
| 92 | +} |
| 93 | +---- |
| 94 | + |
| 95 | +Rule to Scale Redis to 50gb at 7:00am every weekday: |
| 96 | +[source,json] |
| 97 | +---- |
| 98 | +{ |
| 99 | + "dbId": "123456", |
| 100 | + "ruleType": "IncreaseMemory", |
| 101 | + "scaleType": "Deterministic", |
| 102 | + "scaleValue": 50, |
| 103 | + "scaleCeiling": 50, |
| 104 | + "triggerType":"scheduled", |
| 105 | + "triggerValue":"0 7 * * 1-5" |
| 106 | +} |
| 107 | +---- |
| 108 | + |
| 109 | +Rule To Scale Redis up 3 GB: |
| 110 | +[source,json] |
| 111 | +---- |
| 112 | +{ |
| 113 | + "dbId": "123456", |
| 114 | + "ruleType": "IncreaseMemory", |
| 115 | + "scaleType": "Step", |
| 116 | + "scaleValue": 3, |
| 117 | + "scaleCeiling": 50, |
| 118 | + "triggerType":"webhook" |
| 119 | +} |
| 120 | +---- |
0 commit comments