Optimizing CPU cores and threads for Oracle on AWS
MacBook:~ $ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Password:
Running cmd: /anaconda3/bin/python virtualenv.py --no-download --python /anaconda3/bin/python ...
You can now run: /usr/local/bin/aws --version
MacBook:~ $ aws --version
aws-cli/1.15.59 Python/3.6.5 Darwin/17.7.0 botocore/1.10.58
MacBook:~ $
With our tool updated, we can run the command "aws rds create-db-instance" and create an instance with the reduced number of cores. I used db.r3.xlarge class instance for AWS RDS for Oracle for the demonstration. The full command looks like :
aws rds create-db-instance --db-instance-identifier orcl --allocated-storage 20 --db-instance-class db.r3.xlarge --engine oracle-ee --master-username superdba --master-user-password "Mysecretpassword" --no-multi-az --backup-retention-period 0 --engine-version 12.1.0.2.v12 --license-model bring-your-own-license --publicly-accessible --storage-type gp2 --processor-features "Name=coreCount,Value=1"
The instance was created and, for db.r3.xlarge, we should have 2 CPU cores and 4 vCPU (threads) by default. We have reduced the number of cores from default 2 to 1 or to 2 vCPU having two threads per core. It should now show only two CPUs used by the Oracle instance. Let's connect to the instance and check it out.
orcl.qwrrtdbklb.us-east-1.rds.amazonaws.com:1521/orcl> show parameter cpu_count
NAME TYPE VALUE
------------------------------- ------- -----
cpu_count integer 2
orcl.qwrrtdbklb.us-east-1.rds.amazonaws.com:1521/orcl>
It looks right and even if we don't see it from the Web GUI interface, we always can confirm it using the CLI command "aws rds describe-db-instances":
MacBook:~ $ aws rds describe-db-instances
{
"DBInstances": [
{
"DBInstanceIdentifier": "orcl",
"DBInstanceClass": "db.r3.xlarge",
"Engine": "oracle-ee",
….
"PerformanceInsightsEnabled": false,
"ProcessorFeatures": [
{
"Name": "coreCount",
"Value": "1"
}
]
}
]
}
MacBook:~ $
Let's modify the number of threads per core reducing number of vCPU to one.
MacBook:~ $ aws rds modify-db-instance --db-instance-identifier orcl --processor-features "Name=threadsPerCore,Value=1" --apply-immediately
{
"DBInstance": {
"DBInstanceIdentifier": "orcl",
"DBInstanceClass": "db.r3.xlarge",
"Engine": "oracle-ee",
…
After the maintenance has been completed, we can verify the number of CPUs used by the instance again.
orcl.qwrrtdbklb.us-east-1.rds.amazonaws.com:1521/orcl> show parameter cpu_count
NAME TYPE VALUE
--------- ------- -----
cpu_count integer 1
orcl.qwrrtdbklb.us-east-1.rds.amazonaws.com:1521/orcl>
It worked correctly and now we can return everything back to default using the option "--use-default-processor-features".
MacBook:~ $ aws rds modify-db-instance --db-instance-identifier orcl --use-default-processor-features --apply-immediately
{
"DBInstance": {
"DBInstanceIdentifier": "orcl",
"DBInstanceClass": "db.r3.xlarge",
"Engine": "oracle-ee",
…
orcl.qwrrtdbklb.us-east-1.rds.amazonaws.com:1521/orcl> show parameter cpu_count
NAME TYPE VALUE
--------- ------- -----
cpu_count integer 4
orcl.qwrrtdbklb.us-east-1.rds.amazonaws.com:1521/orcl>
It has worked pretty well from the command line and I hope the GUI interface is going to be fixed soon so that we are able to set it up and see it from the web console. I think the new feature may help some customers with their cloud migration, providing more options to choose instance type, according to the load rather than the CPU count.
On this page
Share this
Share this
More resources
Learn more about Pythian by reading the following blogs and articles.
Oracle database upgrade on RDS AWS and SPM baselines
Oracle database upgrade on RDS AWS and SPM baselines
Dec 5, 2017 12:00:00 AM
9
min read
Hugepages support for Oracle RDS
Hugepages support for Oracle RDS
Jun 27, 2018 12:00:00 AM
4
min read
How to enable binary logging on an Amazon RDS read replica

How to enable binary logging on an Amazon RDS read replica
Feb 8, 2018 12:00:00 AM
3
min read
Ready to unlock value from your data?
With Pythian, you can accomplish your data transformation goals and more.