How can I improve the CPU performance of my Amazon EC2 Linux instances?
I want to improve the performance of my Amazon Elastic Compute Cloud (Amazon EC2) Linux instances. What are some ways I can do that?
"I want to improve the performance of my Amazon Elastic Compute Cloud (Amazon EC2) Linux instances. What are some ways I can do that?ResolutionTo improve the performance of your Amazon EC2 Linux instances, try the following recommendations:Hardware virtual machine (HVM) Amazon Machine Images (AMIs)We recommend using HVM AMIs for improved performance. HVM AMIs also offer newer instance classes (for example, M5, M4, and R4) and Amazon EC2 features such as enhanced networking. For more information, see Linux AMI virtualization types.Enhanced networkingTo improve performance, you can use enhanced networking on supported instance types at no additional charge. Enhanced networking uses single root I/O virtualization (SR-IOV), which is a method of device virtualization that provides higher I/O performance and lower CPU utilization when compared to traditional virtualized network interfaces. For supported instance types and instructions, see Enhanced networking on Linux and Enhanced networking on Windows.To enable enhanced networking, the instances must use an HVM AMI and be launched in an Amazon Virtual Private Cloud (Amazon VPC).Note: It's a best practice to use the updated version of the Elastic Network Adapter (ENA) or the Intel 82599 Virtual Function (VF) interface driver.Non-volatile memory express (NVMe) volumesFor storage, using NVMe instance store volumes can assist with performance. Depending on your kernel version and instance type, improved performance with NVMe volumes can vary with workload. For more information, see Amazon EBS and NVMe and SSD instance store volumes.Note: To use the Kyber I/O scheduler for certain workloads, be sure that your Amazon EC2 Linux instance is running kernel 4.12 or newer.HugePagesHugePages can improve performance for workloads that deal with large amounts of memory access. For more information, see the HugePages documentation on the kernel.org website. For best practices regarding High-Performance Computing (HPC) workloads, see High-Performance Computing Lens.Latest kernel version and instance typesUsing the latest kernel version and instance types is highly recommended for performance. If you’re using M3, C3, or other older instance types, consider migrating to M4 or similar instance types, as well as using the latest kernel version available for the operating system. For more information, see Amazon EC2 Instance Types.Jumbo framesAvoid small packets whenever possible. If your workload supports it, use larger packets with jumbo frames. For more information, see Network maximum transmission unit (MTU) for your EC2 instance.Data Plane Development Kit (DPDK)You might see performance benefits from using DPDK-based versions of software to move networking outside the kernel and into userspace. Using DPDK can require a software update that includes DPDK support. For more information, see the DPDK website.Process Context Identifier (PCID)If Kernel Page-Table Isolation (KPTI) is enabled on your instance's operating system, then also enabling PCID can improve CPU performance. You must verify that both the kernel and instance type support PCID.Scaling instancesTo improve performance, consider increasing the size of your instances, or increasing the number of instances.TimersThe tsc timer is generally the best performing timer available to most instances. If you’re using a xen timer, you might see improved performance by moving to the tsc timer. If you’re using an older operating system that’s using the jiffies timer, consider moving to an operating system that preferably supports tsc, or supports xen at minimum.Note: Older instance types, such as M1 or M2, provide an emulated tsc timer. Consider moving to a newer instance type for better tsc timer performance.Related informationBest practices for Amazon EC2Follow"