Often times i get asked from customers whether it would be possible to schedule the STOP/START and/or the scale UP/DOWN of compute and/or DBaaS instances.
At present this is not possible from the OCI console, however using pre-defined tags, you can schedule automatic scale up and down event.
Once Created a Tag Namespace called “Schedule”, you need to create the following Tag Key Definitions:
- AnyDay
- WeekDay
- Weekend
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday
After that you can add the takes to any instance you want to Autoscale based on a schedule. The tag should contain 24 numbers, separated by commas. Each number represents the amount of CPUs for that specific hour.
You can find further information with regards to how to automate START and STOP of either compute or DBaaS instance here.
Besides OCI has recently launched the Auto Scaling feature, which gives you the ability to easily right-size the compute fleet to handle application loads.
OCI Autoscaling enables you to automatically adjust the number of Compute instances in an instance pool based on performance metrics such as CPU and memory utilization. This helps you provide consistent performance for your end users during periods of high demand, and helps you reduce your costs during periods of low demand.
Autoscaling leverages Compute instance pools and Oracle Cloud Infrastructure Monitoring. Instance pools let you pool virtual machine (VM) instances together and keep all VM instances in your pool healthy and running. Monitoring lets you capture average CPU and memory utilization metrics from your pool. With autoscaling, you can create an autoscaling configuration with policies and rules that will launch or terminate instances if thresholds are exceeded on the metrics coming from your pool of VM instances. Autoscaling will be a free-to-use feature in Compute.
Walk through of OCI Autoscaling
To use Oracle Cloud Infrastructure Autoscaling, you must be given the necessary grants by the OCI Administrator.
-For administrators: For a typical policy that gives access to autoscaling configurations, see Let users manage autoscaling configurations.
1)as first step you need to create a instance configuration (template) from your instance.
2) then you need to create a instance pool.
3) Finally you can associate a Autoscaling Configuration to your instance Pool, defining the Autoscaling Policy.
4) you can now stress your CPU and trigger autoscaling.
Example: To stress the CPU, on a Oracle Linux machine, you can pass the following parameter to one of the instances of the pool:
$sudo yum install stress -y
$stress -c 2
The Autoscaling will evaluate scaling actions on the pool every 300 seconds.
Optionally, you can navigate to the Monitoring console, select the new pool that you have created, and see the CPU metrics emit and get tracked.
You will then see metrics for all the instances in your pool. You can also choose to aggregate the metrics.
This is an example of OCI autoscaling using OKE (Oracle container engine) as load generator.