Customise the variety of vCPUs on your RDS SQL Server cases
Obtain desired memory-to-CPU ratios for particular workloads
Doubtlessly cut back licensing prices and achieve extra flexibility in total value administration
On this publish, we discover how you need to use the Optimize CPU characteristic with Amazon RDS for SQL Server, together with:
Creating a brand new occasion by configuring Optimize CPU
Modifying an present occasion with Optimize CPU
Restoring from a snapshot that’s configured with Optimize CPU
Performing a point-in-time restore (PITR) with Optimize CPU
Conditions
The examples on this publish use the AWS Command Line Interface (AWS CLI). You need to have primary information of making an RDS for SQL Server DB occasion and perceive CPU structure ideas (cores, threads per core, and vCPUs).
You must also be conversant in how the Optimize CPU characteristic impacts each Amazon RDS for SQL Server pricing and DB occasion efficiency.
Creating a brand new occasion with Optimize CPU
To create an RDS SQL Server occasion with Optimize CPU, use the create-db-instance command with the --processor-features parameter. Specify values for coreCount and threadsPerCore. The next command creates an occasion with 8 cores and 1 thread per core, leading to 8 vCPUs whole.
It’s necessary to specify each coreCount and threadsPerCore for --processor-features parameter.
coreCount: You possibly can customise the variety of CPU cores for the occasion. See DB occasion courses that help Optimize CPU to search out the allowed values for core depend for a specific occasion sort.
threadsPerCore: Threads per core is configured to outline the variety of threads per CPU core. Ranging from the seventh era occasion class sort, the optimized CPU characteristic is supported, and the allowed worth for threads per core is 1, because the seventh era occasion has Hyper-threading disabled.
The --processor-features parameter requires a minimal of 4 vCPU for Amazon RDS for SQL Server.
To confirm these settings, use the describe-db-instances command:
The next is an outline of the Optimize CPU characteristic because it seems within the AWS Administration Console.
Word: We suggest benchmarking your workload with the Optimize CPU characteristic in order that the configured vCPU can deal with the workload with out inflicting useful resource constraints on your workload or RDS automation.
Modifying an present occasion with Optimize CPU
Occasion modification with –use-default-processor-features
To revert an Optimize CPU occasion to default settings, you need to use the --use-default-processor-features parameter.
For instance, the next command modifies an present occasion (rfs-test-ocpu-instance) that’s configured with a db.r7i.8xlarge occasion sort and processor characteristic setting of 8 cores and 1 thread, to its default settings.
Within the earlier instance, the prevailing occasion of db.r7i.8xlarge configured with Optimize CPU settings of 8 cores and 1 thread per core is transformed again to make use of the default settings of db.r7i.8xlarge occasion sort with 16 cores and 1 thread per core.
For Multi-AZ cases, each the first and secondary cases could have equivalent vCPU configurations in accordance with processor characteristic settings.
Word: If you modify a DB occasion to configure Optimize CPU, there’s a temporary DB occasion downtime identical because it takes once you modify the occasion class sort
Occasion modification with –processor-features
You possibly can modify an present occasion to specify processor characteristic settings. For instance, the next command modifies an present occasion (rfs-test-ocpu-instance) that’s configured with a db.r7i.8xlarge occasion sort and default settings to customized setting of Optimize CPU.
By default, the db.r7i.16xlarge occasion helps 32 cores and 1 thread per core, leading to a complete of 32 vCPUs. Using the Optimize CPU characteristic with the desired settings, it would modify the occasion to eight cores and 1 thread per core leading to a complete of 8 vCPUs.
Restoring from a snapshot that’s configured with Optimize CPU
When restoring from a snapshot of an occasion with Optimize CPU enabled, the settings are copied to the goal occasion by default. You can too specify totally different Optimize CPU settings throughout the restore course of.
Snapshot restore with the Optimize CPU characteristic
On this instance, we’re utilizing a snapshot backup of an present occasion (rfs-test-ocpu-instance) configured with Optimize CPU settings. It makes use of db.r7i.16xlarge occasion sort and Optimize CPU settings of 8 cores and 1 thread per core, ensuing into a complete 8 vCPU’s.
For restore-db-instance-from-db-snapshot, we didn’t specify the occasion sort or Optimize CPU settings, so Amazon RDS creates an occasion with the identical occasion sort (db.r7i.16xlarge) and Optimize CPU settings (8 cores, 1 thread per core) from the snapshot.
There are a number of situations to make use of the Optimize CPU characteristic with snapshot restore.
Restore a snapshot to a distinct occasion sort and default processor options
You possibly can restore a snapshot taken on Optimize CPU enabled occasion by specifying the totally different occasion sort and --use-default-processor-features.
For this instance, we’re utilizing a snapshot backup of an present occasion (rfs-test-ocpu-instance) configured with Optimize CPU settings. The unique occasion makes use of a db.r7i.16xlarge occasion sort and Optimize CPU settings of 8 cores and 1 thread per core, leading to a complete of 8 vCPUs.
The next command restores a snapshot to a distinct occasion sort (db.r7i.8xlarge) with its default CPU settings (16 cores and 1 thread per core).
(Invalid) Restore a snapshot to a distinct occasion sort and no processor options set
When restoring a snapshot from an Optimize CPU-enabled occasion to a distinct occasion sort, you can not omit the processor characteristic settings. The next instance demonstrates what occurs in case you try this.
On this situation, we’re restoring a snapshot from an occasion (rds-test-ocpu-instance), configured with db.r7i.16xlarge, 8 cores, and 1 thread per core, to a distinct occasion sort (db.r7i.8xlarge) with out specifying processor options:
An error occurred (InvalidParameterCombination) when calling the RestoreDBInstanceFromDBSnapshot operation:
Your request should specify ProcessorFeatures settings or set UseDefaultProcessorFeatures for the reason that snapshot has ProcessorFeatures set.
When a snapshot has processor options enabled and also you specify a distinct occasion sort throughout restore, you need to explicitly present both the ProcessorFeatures settings or UseDefaultProcessorFeatures choice.
Restore a snapshot to a distinct occasion sort with customized processor options
For instance, the next command restores a snapshot of an occasion (rfs-test-ocpu-instance) configured with Optimize CPU settings (8 core and 1 thread per core) utilizing the db.r7i.16xlarge occasion sort. We specified a brand new occasion sort (db.r7i.12xlarge) and new Optimize CPU settings (18 cores, 1 thread per core).
With Level-in-Time Restore (PITR) you may restore an occasion to a particular time limit. This course of entails restoring a particular snapshot primarily based on the designated time for PITR and subsequently making use of all transaction log backups to that snapshot, thereby bringing the occasion to the desired time limit.
For PITR, the processor characteristic settings for coreCount and threadsPerCore are derived from the supply snapshot (not the time limit) except customized values are specified throughout the PITR request. If the supply snapshot getting used is enabled with Optimize CPU and you might be utilizing a distinct occasion sort for PITR, you need to outline the Optimize CPU choices for the goal occasion or specify the --use-default-processor-features choice. The use circumstances described above for snapshot restore are additionally relevant to PITR.
TimeStamp-1: Describe supply database occasion that’s configured with Optimize CPU
For instance, we’ve an occasion (rfs-test-ocpu-instance-8) that’s run on a db.r7i.8xlarge occasion sort with Optimize CPU settings of 8 cores and 1 thread per core. The next command exhibits the occasion configuration.
On the time of Level-in-Time Restore (PITR) the supply occasion is operating on a db.r7i.8xlarge occasion sort, that includes 4 cores and 1 thread per core. Nevertheless, the restored occasion’s (utilizing the most recent restorable time) CPU settings are derived from the snapshot utilizing 8 cores and 1 thread per core.
Clear up
Should you not want your RDS for SQL Server occasion, delete it to keep away from incurring extra prices.
Conclusion
On this publish, we demonstrated the right way to use the Optimize CPU characteristic on Amazon RDS for SQL Server to customise vCPU allocation, probably lowering prices and optimizing efficiency on your particular workloads. We lined creating new cases, modifying present ones, and performing snapshot restores and point-in-time recoveries with Optimize CPU settings. By fine-tuning your CPU assets, you may obtain higher value optimization whereas sustaining the efficiency your functions require. We encourage you to check out this characteristic on your use circumstances and share your experiences within the feedback beneath.