Automatic Scaling for OCI BM Database Cloud Service (Schedule based)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
AutoScale.py
AutoScale_ADW_ATP.py
LICENSE
README.md
README.md.bak
instanceMetadata.py
instanceMetadata.pyc

README.md

OCI-AutoScale

There are 2 main Autoscaling Scripts here.

Autoscale; this script is designed to run inside the Baremetal instances running the Oracle Database Cloud Service. Autoscale_AWD_ATP; this script is designed to scall ALL ADW and ATP services that have a valid Schedule tag. You need to run this script somewere that has internet access so it can talk to the Oracle Cloud API. This can be in the cloud or on-premise.

Auto Start and Stop

As the ATP and ADW services also support turning an instance on and off (and reducing cost), the AWD_ATP script supports this now. If you specify and 0 (zero) for the hour, it will stop the service. If the services is stopped and the hour requires more then 0 cpu cores, it will automatically start the instance and then scale it to the appropriate size.

As the starting takes some time, I have updated the ADW_ATP script with support for multi threading, so that all scaling actions happen at the same time, and not sequencially.

How to use

Using pre-defined tags, you can schedule automatic scale up and down event.

Created a Tag Namespace called "Schedule" In that namespace 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 database instance you want to Autoscale based on a schedule. The tag should contain 24 numbers, sperated by commas. Each number represents the amount of CPUs for that specific hour.

Running the Scripts

The script can be run without a parameter or with the parameter "up" or "down". If the "up" parameter is specified the script will only execute scaling Up actions. If "down" is specified, it will only do scaling Down actions. If nothing is specified, the script will do BOTH scaling up and down actions.

I would recommend you run scaling down actions 1 or 2 minutes before the end of the hour and run scaling up actions just after the hour.

Scaling Example

More information

Please check www.oc-blog.com

Demo video: https://youtu.be/5jsGgfClPAM