AWS Database Blog

New features to reduce and optimize vCPUs on Amazon RDS for Oracle Database

Many AWS users are taking advantage of the managed service offerings that are available in AWS to remove much of the undifferentiated heavy lifting from their day-to-day activities. Amazon Relational Database Service (Amazon RDS) is one of the available managed services for your relational database deployments. With Amazon RDS, you can significantly reduce the administrative overhead of managing and maintaining a relational database. Amazon RDS makes it easy to set up, operate, and scale Oracle Database deployments in the cloud. You can deploy multiple editions of Oracle Database in minutes with cost-efficient and resizable hardware capacity. For details, see Amazon RDS for Oracle Database.

Like all AWS services, our Amazon RDS roadmap is driven mostly by customer feedback and requests for product enhancement. We have received feedback from several enterprise customers who are running their database workloads on Amazon RDS for Oracle Database. The feedback suggests that enterprises that run Oracle workloads can enhance the value of their software licenses by keeping the RAM per physical core ratio significantly higher than what is offered on Amazon RDS for Oracle.

We heard similar feedback from customers who operate memory-intensive database workloads. These databases often require additional memory with very few or no CPUs required to sustain the growth of the workload. Given this constraint, customers ended up over-provisioning their CPUs to get more memory. But because Oracle has a CPU-based licensing scheme for Oracle Database software, this action results in additional licensing costs.

The goal of this post is to describe how you can reduce the number of virtual CPUs (vCPUs) and manage licensing costs for your database workloads by using two new features for Oracle Databases on Amazon RDS:

  1. X1 and X1e instance support
  2. Optimize CPU

Launch #1: Support for X1 and X1e instances in Amazon RDS for Oracle

Recent customer examples and feedback suggest that enterprises running Oracle workloads can enhance the value of their software licenses by keeping the RAM per physical core ratio greater than 30.

Amazon RDS supports three types of instance classes: Standard, Memory Optimized, and Burstable Performance. For more information about Amazon EC2 instance types, see Instance Types in the Amazon EC2 documentation.  For information about all the DB instance types that Amazon RDS for Oracle supports, see DB Instance Class.

As of May 25, 2018, you can now launch an Amazon RDS for Oracle database on the X1 and X1e instance types. X1 and X1e instances offer the highest ratio of memory to vCPU among current Amazon EC2 instance types. The X1e instance type provides 30.5:1 RAM (GB) per vCPU or 61:1 RAM (GB) per physical core ratio (for example, db.x1e.16xlarge comes with 64 vCPUs and 1952 GB of RAM). The X1 instance type provides 15.25:1 RAM (GB) per vCPU or 30.5:1 RAM (GB) per physical core ratio (for example, db.x1.16xlarge comes with 64 vCPUs and 976 GB of RAM).

The X1 and X1e DB instance types are optimized for memory-intensive and latency-sensitive database workloads, including data analytics, in-memory databases, and high-performance production workloads. X1 and X1e instances let you enhance the value of your Oracle licenses by increasing memory without increasing processor license counts.

Launch #2: Optimize CPU in Amazon RDS

Before the Optimize CPUs capability became available in Amazon EC2, you were limited to selecting EC2 instances that best matched the RAM-to-core ratio requirements of your workloads. This frequently led to suboptimal vCPU selections, which resulted in very high licensing costs. X1/X1e instance support in Amazon RDS for Oracle provides the highest ratio of memory to vCPU. It can help with vCPU-based licensing costs because you can now get a sufficient amount of RAM with a smaller number of vCPUs.

X1 and X1e instances can help with your workloads, but there is still a fixed ratio between memory and vCPU. That is, if you’re running workloads that primarily require more memory to satisfy your workload growth, you will have to add more CPUs to get more memory. For example, if you’re running a memory-intensive workload that requires about 1 TB of RAM and 16 vCPUs to meet your requirements, the best option is the DB instance type db.X1e.8Xlarge. But this instance type comes with 32 vCPUs, and you would have to get licensing for 16 additional vCPUs.

Following the Optimize CPUs launch announcement from EC2 (which was met with delight from House of Brick Technologies), we are extending the optimize CPU feature to Amazon RDS for Oracle. With Optimize CPU, you can select EC2 instances with optimal memory, storage, and networking, while enabling only the vCPUs that you need, thus managing your vCPU-based licensing costs.

This feature can help you do the following:

  1. Specify a custom number of vCPUs (while enjoying the same memory, storage, and bandwidth of a full-sized instance) when launching new Amazon RDS for Oracle instances.
  2. Optionally disable Intel Hyper-Threading Technology (Intel HT Technology) for workloads that perform well with single-threaded CPUs, such as certain high-performance computing (HPC) applications.

Intel HT Technology is enabled by default on EC2 instance types, but certain applications (such as HPC applications) are not designed to benefit from it. When Intel HT Technology is enabled, compute-intensive workloads experience performance degradation due to context switching. This feature enables those customers to fine-tune application performance and manage licensing costs.

Optimize CPU components

In most cases, there is a DB instance class that has a combination of memory and number of vCPUs to suit your workloads. However, you can specify the following processor features to optimize your DB instance for specific workloads or business needs.

To configure the Optimize CPU feature on the DB instance class for a DB instance, you use the AWS CLI and include the processor-features option in the command. The processor-features attribute takes the following two parameters as input:

  1. Number of CPU cores (coreCount): The coreCount attribute specifies the maximum number of CPU cores available for use on the DB instance. You can customize the number of CPU cores for the DB instance and still be able to use the same memory, storage, and bandwidth of a full-sized instance. You can use this feature to manage the vCPU-based licensing costs of your software with a DB instance that has sufficient amounts of RAM for memory-intensive workloads but fewer CPU cores. Consider our earlier example in which the primary requirement was to have a DB instance with close to 1 TB memory and 16 vCPUs. The DB instance type db.x1e.8xlarge best matches the requirement (with 976 GB RAM and 32 vCPUs), but with the downside that it will require additional licensing for those extra 16 vCPUs. Now with the Optimize CPU feature, you can customize the db.x1e.8xlarge instance and use only 16 vCPUs (which requires Oracle Database licensing for only 16 vCPUs). You can still use the total available memory, storage, and networking capacity of the DB instance.
  2. Threads per core (threadsPerCore): Using the threadsPerCore attribute, you can disable Intel HT Technology by specifying a single thread per CPU core. You might do this for certain workloads, such as HPC workloads.

You can control the number of CPU cores and threads per core separately. You can set one or both in a request. After a setting is associated with a DB instance, the setting persists until it is changed.

You can configure the number of CPU cores and threads per core for the DB instance class in the following operations:

  1. Creating a DB instance
  2. Modifying a DB instance
  3. Restoring a DB instance from a snapshot
  4. Restoring a DB instance to a point in time

For additional details on the Optimize CPU feature for Amazon RDS for Oracle, see Configuring the Processor for a DB Instance Class.

Implementing Optimize CPU on Amazon RDS DB instances running Oracle

Now that you understand how the Optimize CPU feature works, it’s time to implement it. In this example, we use the AWS CLI utility to implement the Optimize CPU features. For details on how to configure the AWS CLI, see Configuring AWS CLI.

By default, Amazon RDS DB instance classes support Intel Hyper-Threading Technology, which enables multiple threads to run concurrently on a single Intel Xeon CPU core. Each thread is represented as a vCPU on the DB instance. A DB instance has a default number of CPU cores, which varies according to DB instance type. For example, a db.r4.4xlarge DB instance type has eight CPU cores and two threads per core by default—16 vCPUs in total.

By default (without the Optimize CPU feature), an Amazon RDS for Oracle DB instance is created with the 16 vCPUs and hyper-threading enabled. With Optimize CPU, you can specify the subset of total vCPUs on the instance and disable the hyper-threading on the DB instance.

Enabling Optimize CPU when creating a new DB instance

Follow these steps to enable the Optimize CPU feature when you first create your DB instance:

  1. Query the allowed values for the specific Amazon RDS DB instance type that you plan to use for creating the Amazon RDS for Oracle Database instance. The AWS CLI has added a new API called describe-orderable-db-instance-options. You can use it to view all possible values for the coreCount and threadsPerCore for a specific DB instance. The following example uses the DB instance type db.r4.4xlarge. The output of the command is truncated, and only the relevant output is shown. For all available DB instances supported on Amazon RDS for Oracle, see DB Instance Class.
    [ec2-user@ip-XXX-XX-XX-XXX ~]$ aws rds describe-orderable-db-instance-options --engine oracle-ee  --db-instance-class db.r4.4xlarge
    
    "AvailableProcessorFeatures": [
                    {
                        "DefaultValue": "8", 
                        "Name": "coreCount", 
                        "AllowedValues": "1,2,3,4,5,6,7,8"
                    }, 
                    {
                        "DefaultValue": "2", 
                        "Name": "threadsPerCore", 
                        "AllowedValues": "1,2"
                    }
                ],
  2. Create the Amazon RDS for Oracle DB instance with the Optimize CPU feature on. In this example, you create the DB instance and enable the Optimize CPU feature using the processor-features attributes to specify any of the allowed values for the CoreCount and the threadsPerCore attributes. The following example creates the DB instance on a db.r4.4xlarge instance type, allocating only two physical cores (out of total eight physical cores) and disabling the hyper-threading.
    aws rds create-db-instance --db-instance-identifier optimized-cpu-db --engine oracle-ee --engine-version 11.2.0.4.v12 --db-instance-class db.r4.4xlarge --master-username admin --master-user-password password --allocated-storage 50  --region us-west-2 --db-subnet-group-name default --processor-features "Name=coreCount,Value=2" "Name=threadsPerCore,Value=1"

    The preceding AWS CLI command create-db-instance requires several input parameters. The following table contains the description of the parameters used in the example.

      Attribute name Attribute Value
    1 --db-instance-identifier User-defined name for the Amazon RDS for Oracle DB instance identifier (set to optimized-cpu-db in the example).
    2 --engine Oracle Database engine edition (set to oracle-ee in the example).
    3 --engine-version Oracle Database engine version (for example, 11.2.0.4.v12).
    4 --db-instance-class User-defined DB instance class for the Amazon RDS for Oracle DB that matches your workload requirement (for example, db.r4.4xlarge).
    5 --master-username User-defined value for the Amazon RDS for Oracle Database master user (set to admin in the example).
    6 --master-user-password User-defined value for the Amazon RDS for Oracle Database master user’s password (set to password in the example).
    7 --allocated-storage User-defined value for the Amazon EBS storage (GB) allocated to the Amazon RDS for Oracle DB instance.
    8 --region User-defined value for the AWS Region in which the DB instance needs to be created (for example, us-west-2).
    9 --db-subnet-group-name Allows you to specify a particular virtual private cloud (VPC) when creating DB instances (set to use the default db-subnet in the example).
    10 --processor-features Option to enable the optimize CPU feature, user-defined values for the coreCount and threadsPerCore within the allowed values for the specific instance type (in the example, coreCount is set to 2 and threadsPerCore is set to 1).
  3. Verify that the Optimize CPU feature is enabled on the created instance. After the DB instance is created, you can verify whether the Optimize CPU feature has been enabled by using the AWS CLI command describe-db-instances. If the Optimize CPU option has been enabled, the output of this command will have an additional section ProcessorFeatures. It will display the CoreCount and the threadsPerCore for the DB instance as shown in the following example. (The output is truncated to show only the relevant details.)
    [ec2-user@ip-XXX-XX-XX-XXX ~]$ aws rds describe-db-instances --db-instance-identifier optimized-cpu-db --region us-west-2
    
    "ProcessorFeatures": [
                    {
                        "Name": "coreCount", 
                        "Value": "2"
                    }, 
                    {
                        "Name": "threadsPerCore", 
                        "Value": "1"
                    }
                ],

Using Optimize CPU after the DB instance is created

Optimize CPU is not only configurable when you create an Amazon RDS DB instance running Oracle, but you can also configure it after the instance is created. You can specify the number of CPU cores and threads per core for the DB instance class using the modify-db-instance command.

Before you decide to modify the DB instance and provide customized values for the CoreCount and threadsPerCore, you can use the describe-valid-db-instance-modifications AWS CLI command to look at the possible allowed values for these attributes, as shown following. (The output is truncated to show only the relevant details.)

[ec2-user@ip-XXX-XX-XX-XXX ~]$ aws rds describe-valid-db-instance-modifications --db-instance-identifier optimized-cpu-db --region us-west-2

"ValidProcessorFeatures": [
            {
                "DefaultValue": "8", 
                "Name": "coreCount", 
                "AllowedValues": "1,2,3,4,5,6,7,8"
            }, 
            {
                "DefaultValue": "2", 
                "Name": "threadsPerCore", 
                "AllowedValues": "1,2"
            }
        ]

From this output, you can see the allowed values for the Optimize CPU features for the Amazon RDS for Oracle DB instance that you created earlier, in step 2.

Now you can proceed with modifying your DB instance. You will be using the custom values for CoreCount and threadsPerCore as 2 and 4 respectively, as shown following. This example uses a flag—apply-immediate—to instruct Amazon RDS to apply the modification immediately (this action results in the reboot of the database and will incur a small down time).

[ec2-user@ip-XXX-XX-XX-XXX ~]$ aws rds modify-db-instance --db-instance-identifier optimized-cpu-db --region us-west-2 --processor-features "Name=coreCount,Value=4" "Name=threadsPerCore,Value=2" --apply-immediate

When the DB instance modification is finished, you can verify the change in the CoreCount and threadsPerCore of the DB instance by running the describe-db-instances AWS CLI command. The output is truncated to show only the relevant details.

[ec2-user@ip-XXX-XX-XX-XXX ~]$ aws rds describe-db-instances --db-instance-identifier optimized-cpu-db --region us-west-2

"EngineVersion": "11.2.0.4.v12",
"ProcessorFeatures": [
                {
                    "Name": "coreCount", 
                    "Value": "4"
                }, 
                {
                    "Name": "threadsPerCore", 
                    "Value": "2"
                }
            ],

 

Resetting the DB instance to the default processor configuration

By default, the Optimize CPU feature is disabled on Amazon RDS for Oracle. This means that all the Amazon RDS for Oracle DB instances are created with the default processor configuration for the underlying Amazon RDS DB instance type. The example uses the db.r4.4xlarge DB instance type and the default configuration (with the Optimize CPU feature disabled). The Amazon RDS for Oracle DB instance is then created with all the 16 vCPUs and hyper-threading enabled.

We already enabled the Optimize CPU features and have used only a subset of the physical cores available on the DB instance. But we have the option to modify the Amazon RDS for Oracle DB instance and bring it back to the default configuration (that is, with all the physical cores and hyper-threading enabled). You can use the modify-db-instance AWS CLI command and the flag --use-default-processor-features, as shown following. The output is truncated to show only the relevant details.

[ec2-user@ip-XXX-XX-XX-XXX ~]$ aws rds modify-db-instance --db-instance-identifier optimized-cpu-db --use-default-processor-features --apply-immediate --region us-west-2

When the DB instance modification is finished, you can verify the changes by running the describe-db-instances AWS CLI command. Because you disabled the Optimize CPU feature and modified the DB instance to the default configuration, the output of the describe-db-instances command doesn’t have the section for Processor Features that displays the CoreCount and the threadsPerCore, as shown in the following output.

The output is truncated to show the relevant details. Note that the section for the Processor Features after EngineVersion and before the CharacterSetName attributes is missing from the output.

            "EngineVersion": "11.2.0.4.v12", 
            "CharacterSetName": "AL32UTF8", 
            "AvailabilityZone": "us-west-2a", 
            "DomainMemberships": [], 
            "StorageType": "standard", 
            "DbiResourceId": "db-56TD5CQRFC7XKKFKQAHBZV4QFE", 
            "CACertificateIdentifier": "rds-ca-2015", 
            "StorageEncrypted": false, 
            "DBInstanceClass": "db.r4.4xlarge", 
            "DbInstancePort": 0, 
            "DBInstanceIdentifier": "optimized-cpu-db"
        }
    ]

Summary

In this post, I discussed two recently launched features for Amazon RDS for Oracle Database. These features can help you manage your Oracle Database software licensing costs and enable support of larger Oracle Database workloads on Amazon RDS.

I demonstrated how you can implement the Optimize CPU feature to specify custom values for the CoreCount and hyper-threading on Amazon RDS for Oracle while creating a new DB instance. In addition, I showed how to modify CoreCount and hyper-threading any time after instance creation, and finally, how to revert the DB instance to the default behavior with all the CoreCount and hyper-threading enabled.

We hope that you found this information useful, and we’re looking forward to learning how these two new features help with optimizing the licensing costs for your specific workloads.


About the Authors

Sameer Malik is a database specialist solutions architect. He works with AWS customers to provide guidance and technical assistance on database projects, helping them improve the value of their solutions when using AWS.