Skip to content

Commit acad34c

Browse files
author
Yoichi Kawasaki
committed
Supported Storage size scale-up
1 parent 075a314 commit acad34c

File tree

12 files changed

+498
-142
lines changed

12 files changed

+498
-142
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Change Log
2+
3+
## 0.6.0 - 2018-05-13
4+
- Support Storage Size Scale Change
5+
- Restrict Alert Metric to Accept: only "cpu_percent" for vCore scale change, only "storage_percent"|"storage_used"|"storage_limit" for Storage size scale change
6+
- Change Webhook timeout to PT10M (10 minutes)
7+
8+
## 0.5.0 - 2018-04-29
9+
- Initial Release
10+
- Support vCore Scale Change

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
# azure-database-scaler
22
Event driven Azure Logic App & Functions App that scale-up or scale-down the capacity of your Azure database service instance (Currently only vCore # is supported)
33

4-
Targets Azure Databases to scale in this project:
4+
### Targets Azure Databases to scale in this project:
55
- [Azure Database for MySQL](https://azure.microsoft.com/en-us/services/mysql/)
66
- [Azure Database for PostgreSQL](https://azure.microsoft.com/en-us/services/postgresql/)
77

8-
What to scale up/down?
8+
### What to scale up/down?
99
- vCores ([What is vCore?](https://docs.microsoft.com/en-us/azure/mysql/concepts-pricing-tiers#compute-generations-vcores-and-memory))
10+
- Storage Size ([What is Storage size?](https://docs.microsoft.com/en-us/azure/mysql/concepts-pricing-tiers#storage))
1011

11-
How to scale up/down?
12-
- azure-database-scaler starts scaling-up or scaling-down the number of vCore when it is triggered by Azure Monitor Metric Alerts (Alerts providers must be either `Microsoft.DBforMySQL` or `Microsoft.DBforPostgreSQL`)
12+
### How to scale up/down?
13+
- azure-database-scaler starts changing vCore capacity or Storage size when it was triggered by Azure Monitor Metric Alerts (Alerts providers must be either `Microsoft.DBforMySQL` or `Microsoft.DBforPostgreSQL`)
1314
- azure-database-scaler scale-up or scale-down the number of vCore within the same database tier & the same compute generations (Gen4 / Gen5) of your instance in the way like:
1415
- Basic Tier: 1 <-> 2
1516
- General Purpose Tier: 2 <-> 4 <-> 8 <-> 16 <-> 32
1617
- Memory Optimized Tier: 2 <-> 4 <-> 8 <-> 16 <-> 32
17-
- azure-database-scaler scale-up the number of vCore when Alert Operator of triggering Alerts is either `GreaterThan` or `GreaterThanOrEqual`
18-
- azure-database-scaler scale-down the number of vCore when Alert Operator of triggering Alerts is either `LessThan` or `LessThanOrEqual`
18+
- azure-database-scaler only scale-up the Storage size (Not scale-down supported). It can increase the Storage size by the amount of `StorageScaleupSize`(GB) parameter value to specify in [project config file](scripts/project.conf) for each scale-up action triggered by Azure Monitor Metric Alerts until the Storage size reaches `MaxStorageScaleLimit`(GB) parameter value to specify in [project config file](scripts/project.conf). `MaxStorageScaleLimit`(GB) should be within the follwoing storage size range:
19+
- Basic Tier: 5 GB to 1 TB (1024 GB)
20+
- General Purpose Tier: 5 GB to 2 TB (2048 GB)
21+
- Memory Optimized Tier: 5 GB to 2 TB (2048 GB)
1922

20-
Architecture:
23+
### Alert Metrics, Alert Operator, and Actions
24+
25+
|Alert Metric|Metric display name | Operators to match | Action |
26+
|---|---|---|---|
27+
|`cpu_percent`|CPU percent| `GreaterThan` or `GreaterThanOrEqual` | scale-up vCore capacity|
28+
|`cpu_percent`|CPU percent| `LessThan` or `LessThanOrEqual` | scale-down vCore capacity|
29+
|`storage_percent`|Storage percent| `GreaterThan` or `GreaterThanOrEqual` | scale-up Storage size|
30+
|`storage_used`|Storage used| `GreaterThan` or `GreaterThanOrEqual` | scale-up Storage size|
31+
|`storage_limit`|Storage limit| `GreaterThan` or `GreaterThanOrEqual` | scale-up Storage size|
32+
33+
For the detail on the supported metrics, please see [supported metrics for Azure Database for MySQL](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftdbformysqlservers) or [supported metrics for Azure Database for PostgreSQL](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftdbforpostgresqlservers)
34+
35+
### Architecture:
2136
![](images/architecture-overview.png)
2237

2338
Relevant Services:
@@ -29,10 +44,7 @@ Relevant Services:
2944
- [Azure Monitor Alerts (New)](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-overview-unified-alerts)
3045
- [Slack (for notification)](https://slack.com)
3146

32-
## How to deploy the scaler app
47+
## Documents
3348
- [How to deploy the database scaler app](./docs/HOW-TO-DEPLOY-APP.md)
34-
35-
## How to setup Azure Metric Monitor for Autoscaling
36-
- [[Classic Metric Alert] How to setup Azure Monitor Metric Alerts](./docs/HOW-TO-SETUP-ALERTS.md)
37-
- \[New Metric Alert\] How to setup Azure Monitor Metric Alerts
49+
- [How to setup Azure Monitor Metric Alerts for Autoscaling(Classic Metric Alert)](./docs/HOW-TO-SETUP-ALERTS.md)
3850

docs/HOW-TO-DEPLOY-APP.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,16 @@ LogicAppName="<Logic App Name>"
7171
# Storage Account for the App
7272
StorageAccountName="<Storage Account Name>"
7373
74-
# Database Admin/Login User in Azure Database Services (MySQL/PostgreSQL)
74+
# Azure Database Services (MySQL/PostgreSQL) Info
75+
DatabaseLocation="<Azure Region on which you deployed your MySQL/PostgreSQL>"
76+
DatabaseResourceGroup="<Resource Group Name of your Azure Database Services>"
77+
DatabaseAccountName="<Database Account Name of Azure Database Services>"
7578
DatabaseAdminUser="<Database Admin/Login User Name in your Azure Database service>"
7679
DatabaseAdminPassword="<Database Admin User Password in your Azure Database service>"
80+
81+
# Threshold for Alert
82+
MaxStorageScaleLimit="<Max Storage Scale Limit Size in GB>"
83+
StorageScaleupSize="<Storage Scaleup Size for Each scaleup action in GB>"
7784
```
7885
[NOTE] Your Functions App, LogicApp, and Storage Account names must be unique within Azure.
7986

docs/HOW-TO-SETUP-ALERTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33

44
![](../images/alert-configuration-steps.png)
5+
6+
For more detail on the Azure Monitor Metric Alert setup, please see the following page:
7+
- [Use the Azure portal to set up alerts on metrics for Azure Database for MySQL](https://docs.microsoft.com/en-us/azure/mysql/howto-alert-on-metric)

functions/common/Define.csx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
public static class Define
2+
{
3+
public const string resourceNamespace_MySQL = "Microsoft.DBforMySQL";
4+
public const string resourceNamespace_PostgreSQL = "Microsoft.DBforPostgreSQL";
5+
public const string metric_CPU_Percent = "cpu_percent";
6+
public const string metric_Storage_Percent = "storage_percent";
7+
public const string metric_Storage_Used = "storage_used";
8+
public const string metric_Storage_Limit = "storage_limit";
9+
public const string ApiVersion = "2017-12-01";
10+
public const string dbTier_basic = "Basic";
11+
public const string dbTier_generalPurpose = "GeneralPurpose";
12+
public const string dbTier_memoryOptimized = "MemoryOptimized";
13+
public static int[] vcore_scaleModel_basic = { 1, 2 };
14+
public static int[] vcore_scaleModel_generalPurpose = { 2, 4, 8, 16, 32 };
15+
public static int[] vcore_scaleModel_memoryOptimized = { 2, 4, 8, 16, 32 };
16+
public static int[] storageRange_basic = { 5, 1024 }; //GB
17+
public static int[] storageRange_generalPurpose = { 5, 2048 }; //GB
18+
public static int[] storageRange_memoryOptimized = { 5, 2048 }; //GB
19+
}

functions/common/Model.csx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class InternalRequest
2+
{
3+
public string CallbackUrl { get; set; }
4+
public string Region { get; set; }
5+
public string AlertMetric { get; set; }
6+
public string AlertOperator { get; set; }
7+
public string ResourceGroup { get; set; }
8+
public string ResourceProviderNamespace { get; set; }
9+
public string DbName {get;set;}
10+
}

0 commit comments

Comments
 (0)