Introduction
Optimising performance and automating infrastructure management are crucial activities to maintain or reduce cloud service costs. Oracle Cloud Infrastructure (OCI) block storage service provides the ability for users to modify storage performance online, quickly and easily. This blog post explores the advantages of integrating Ansible, a leading automation tool, with OCI Block Storage Dynamic Performance to enhance agility and reduce costs for cloud storage.
Understanding OCI Block Storage Dynamic Performance
What is Dynamic Performance?
OCI Block Storage Dynamic Performance provides users with the flexibility to adjust the performance characteristics of their block volumes dynamically. It enables seamless scaling of storage I/O performance (basically the size of the pipe between the compute services and storage layer) based on application needs. This feature provides opportunities to further optimise both cost and performance – providing high performance storage when needed, and saving storage costs when not needed. Technically this is implemented via assigning Volume Performance Units (VPU’s) to your block volumes. The VPU’s are assigned per Gigabyte..ie..the High Performance block volume setting has 30 VPU’s per GB assigned to the block volume. A block volume of 100G would require 3,000 VPU’s for the High Performance configuration.
Why is this feature so powerful?
OCI Block Volume performance can be modified online and typically completes within minutes (dependent on volume size). This allows IO performance to be increased or decreased in near real-time depending on workloads. Different levels of performance can be configured between block volumes that are attached to your compute or database instance nodes. It solves the problem of providing high performance storage only when required – matched to the business or workload requirements.
Note: Oracle Database Base Services storage configuration is locked on High Performance (30 VPU's per GB).
Practical Uses for OCI Block Storage Dynamic Performance
We have adopted this solution for several use cases in our OCI environment where we needed to increase/decrease storage performance to match application workload requirements.
We typically have different workload profiles between our production and non-production systems:
- Production tends to be busier Monday – Friday 0400 – 0000, but on weekends the busiest period tends to be 0400 – 0700 with workload relatively quiet for the rest of the day. We leave the block volume performance set to High Performance from Mon – Friday for production, then lower it to Balanced Performance outside 0400 – 0700 on weekends.
- Non-production are either not used outside of business hours Mon – Friday, or have very low usage but still need to be online. We shutdown some of these systems and set the block volume storage performance to Low when not required, or we decrease the block volume performance overnight when the environment is not being used.
Harnessing Ansible for OCI Block Storage Dynamic Performance
To take advantage of this feature fully you need to be able to trigger the increase/decrease of the storage performance for the required volumes. This can be done either via a fixed schedule, for example from 0700-1800 each day the relevant block volumes are configured for “High Performance”, outside those hours they are configured for “Low Performance”. Alternatively, if you have certain events that require high performance storage the change can be triggered by an application event.
We used Ansible playbooks to implement this capability in our environment. Ansible playbooks are relatively easy to read and understand, in combination with the OCI Ansible modules provide all the functionality required to achieve this task.
Benefits of Using Ansible with OCI Block Storage
1. Agility in Performance Scaling:
Ansible allows you to dynamically adjust block storage performance through playbooks, typically with a single playbook task (consider this the equivalent of a single API call). Once setup and configured, a single Ansible playbook can be used to manage the storage performance levels of all OCI block storage.
2. Cost Optimisation:
OCI Block Storage Dynamic Performance, combined with Ansible automation provides a cost-effective solution to manage cloud storage costs. There is minimal cost to implement and run the Ansible playbooks, yet depending on your environment, the savings from lowering your storage performance settings can add up considerably over time. Adopting this approach can increase the cost savings associated with a tiered storage configuration.
3. Consistency Across Environments:
Ansible playbooks provide a consistent and repeatable method for configuring block storage performance. We use Ansible playbooks to manage the tags of the block volumes that are then used to determine the required level of performance. This consistency ensures that performance settings are applied uniformly across different environments, reducing the risk of configuration drift.
4. Automation of Complex Tasks:
Ansible provides a relatively easy way to “glue” several complex tasks together into a workflow. We had initially attempted to implement the same automation in bash scripts using the OCI CLI. A better outcome was achieved with Ansible – less code, faster to develop and test and was far easier to integrate into our management framework (CheckMK for CMDB and Ansible inventory, Rundeck for job scheduling).
Implementing Ansible Playbooks for OCI Block Storage Dynamic Performance
1. Install Ansible Modules:
Ensure that the necessary OCI Ansible modules are installed on your control node:
ansible-galaxy collection install oracle.oci
2. Create Dynamic Performance Playbooks:
Develop Ansible playbooks to dynamically configure block storage performance settings based on your application requirements.
The following example playbook obtains the attached block volumes for an instance and sets the VPU per volume based on the relevant tag values:
tasks:
- name: Get OCI Instance
oci_compute_instance_facts:
compartment_id: "{{ cmp_id }}"
config_file_location: /home/ansible/.oci/config_ansibleoci
display_name: "{{ hostname }}"
register: oci_instances
- name: Set instance id
set_fact:
instance_id: "{{ item.id }}"
loop: "{{ oci_instances.instances }}"
- name: Set instance tier type
set_fact:
abc_tier: "{{ item.defined_tags.ResourceLabelsABC.ABCTier }}"
loop: "{{ oci_instances.instances }}"
- name: Get volume attachments oci
oci_compute_volume_attachment_facts:
compartment_id: "{{ cmp_id }}"
config_file_location: /home/ansible/.oci/config_ansibleoci
instance_id: "{{ instance_id }}"
register: vol_attachments
- name: List Block Volumes
oci_blockstorage_volume_facts:
compartment_id: "{{ cmp_id }}"
config_file_location: /home/ansible/.oci/config_ansibleoci
volume_id: "{{ item.volume_id }}"
register: vol_details
loop: "{{ vol_attachments.volume_attachments }}"
- name: Set BV Performance Level Low - DB Tier
oci_blockstorage_volume:
compartment_id: "{{ cmp_id }}"
config_file_location: /home/ansible/.oci/config_ansibleoci
state: present
wait_timeout: 2400
volume_id: "{{ item.volumes.0.id }}"
vpus_per_gb: "{{ item.volumes.0.defined_tags.StoragePerformanceTierLowABC.DatabaseTier }}"
when: (( item.volumes.0.defined_tags.ResourceLabelsABC.ABCEnvironmentName == "ORA1" or item.volumes.0.defined_tags.ResourceLabelsABC.ABCEnvironmentName == "ORA2" ) and ( item.volumes.0.defined_tags.ResourceLabelsABC.ABCTier == "Database" ) and ( item.volumes.0.defined_tags | length > 0 ) and ( {{ tier_perf == "Low" }}))
loop: "{{ vol_details.results }}"
Conclusion
Integrating Ansible with OCI Block Storage Dynamic Performance is a relatively simple entry into OCI workload automation. By automating the configuration of block storage performance, you can deliver high performance storage along with cost savings across your OCI platform.
Interested in how you can save costs in your OCI environment? Get in touch with us to see whats possible.
FAQ
What are the specific prerequisites and technical requirements for integrating Ansible with OCI Block Storage?
Managing OCI Block Storage with Ansible typically requires a working knowledge of both Ansible and the OCI Ansible collection. You need to configure an OCI user with the required privileges to manage the block storage family. The Ansible controller needs to have the required OCI client side configuration completed as well. We have found the best results running this on Oracle Linux 8 and above (or the relevant equivalent of).
Can Ansible be used to automate other aspects of OCI beyond block storage performance adjustments?
Ansible can automate a wide range of tasks in OCI beyond block storage, such as provisioning and managing compute instances, networks, and other cloud resources, thanks to its extensible nature and the availability of OCI modules. The OCI Ansible collection is huge – it covers off most of the OCI services and allows for either query or modify access to OCI services.
How does the use of Ansible with OCI compare to other automation tools in terms of efficiency and ease of use?
Ansible’s efficiency and ease of use compared to other automation tools often depend on the specific use case and the user’s familiarity with the tool. Ansible is known for its simplicity and declarative language, making it accessible for automating tasks without extensive scripting. Like any new technology there is a learning curve – but once mastered Ansible becomes an incredibly useful and powerful tool.