Home > Workload Solutions > SQL Server > Best Practices > Intel-Based SQL Server Best Practices on Dell PowerEdge R740 and PowerMax 2000 > Linux Best Practices > Performance Best Practices > Red Hat Enterprise Linux: SQL Server Tuned Profile
The TUNED_ADM command line tool enables switching between different tuning profiles in Linux. In this best practice, we used the TUNED_ADM tool to switch to an optimized Linux profile for SQL Server.
Category | Operating System |
Product | Red Hat Enterprise Linux 8.3 |
Type of best practice | Performance Optimization |
Day and value | Day 2, Moderate Recommendation |
Overview
The TUNED_ADM tool enables the Linux administrator to switch between profiles for the operating system. Predefined profiles enable the application of Linux configuration settings in a downloadable package. In this best practice the TUNED-MSSQL was downloaded and installed in the Linux OS. This resulted in the following changes in the tuned SQL Server profile:
Certain configuration parameters that adjust the PM QoS CPU DMA latency according to the CPU load. For example, the force latency parameter enables the user or in this case the SQL Server profile to force a specific value. For more information on this CPU configuration parameter and similar parameters, see the Red Hat Performance Tuning Guide.
Transparent HugePage Support (THP) automates the promotion and demotion of memory pages. Promotion is the automation from small memory pages to larger memory page sizes and demotion is the automation from larger memory pages to smaller memory pages. SQL Server uses transparent HugePages to optimize performance thus, this parameter is set to ALWAYS.
Swap space is used by the Linux operating as virtual memory. This works is by the Linux kernel writing data from RAM to the swap space which allows for greater memory use on the system. By changing VM.SWAPPINESS to 1 the kernel is instructed to more aggressively reclaim unmapped memory rather than using swap space.
The DIRTY_BACKGROUND_RATIO is the percentage of memory that contains free pages and reclaimable pages, that can be filled with dirty pages before the pages are written to disk. Databases can aggressively use the kernel page cache which lowers the background ratio forcing the kernel to flush the dirty pages to disk more frequently.
The DIRTY_RATIO is the percentage of total system memory that contain dirty pages before the pages are written to disk. In setting dirty_pages to 80 the kernel is instructed to use 80 percent of total system memory for dirty pages before having to flush the data to disk.
The DIRTY_EXPIRE_CENTISECS define in centisecs (one hundredth of a second) when data is old enough to be written to disk. By setting DIRTY_EXPIRE_CENTISECS to 500 a dirty page can stay in memory for 500 centisecs before it is written to disk.
The DIRTY_WRITEBACK_CENTISECS parameter defines the frequency the kernel will check to write dirty pages to disk. In this case a value of 100 centisecs instructs the kernel to check every 100 centisecs to write dirty pages to disk.
The MAX_MAP_COUNT defines the number of memory map areas a process may include. For example, databases use memory extensively which means increasing this value results in more memory map areas available for the database to use.
In addition to the VM memory settings, this best practice also included network and kernel settings updated by the MSSQL tuned profile. The following list describes the network and kernel settings that were updated by the MSSQL tuned profile:
Note: To maintain concise, no descriptions for these updates are included in this best practice.
Recommendation
Using TUNED_ADM tool to apply the TUNED-MSSQL package automates the application of many best practices in the Linux operating system. After applying the tuned mssql settings, we load tested the new configuration and compared it to the prior performance test. The load OLTP load test showed moderate performance improvements in the following metrics:
The TCP-C NOPM and TPM metrics showed a moderate increase, indicating the changes to the Linux operating system improved performance. PowerMax IOPS, overall CPU utilization, and BRPS showed slight improvements.
Overall, the configuration changes made to the Linux operating system fine tuned memory, network, and kernel configurations. These changes resulted in more efficient usage of system resources, providing moderate performance improvements.
Implementation Steps
In this test case, we are going to create and enable Microsoft and Red Hat tuned-profiles-mssql profiles, which is recommended and offers finer Linux performance-related tunings for SQL Server workloads.
To install tuned-profiles-mssql profile, use yum install command.
Use the following steps to create the profile:
Save the following definitions in a tuned.conf file under a /usr/lib/tuned/mssql folder
# # A Tuned configuration for SQL Server on Linux # [main] summary=Optimize for Microsoft SQL Server include=throughput-performance [cpu] force_latency=5 [sysctl] vm.swappiness = 1 vm.dirty_background_ratio = 3 vm.dirty_ratio = 80 vm.dirty_expire_centisecs = 500 vm.dirty_writeback_centisecs = 100 vm.transparent_hugepages=always # For multi-instance SQL deployments, use # vm.transparent_hugepages=madvise vm.max_map_count=1600000 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 kernel.numa_balancing=0
Note: If you are using Linux distributions with kernel versions greater than 4.18, please comment the following options as shown. Otherwise, uncomment the following options if you are using distributions with kernel versions less than 4.18.
# kernel.sched_latency_ns = 60000000 # kernel.sched_migration_cost_ns = 500000 # kernel.sched_min_granularity_ns = 15000000 # kernel.sched_wakeup_granularity_ns = 2000000
Use the following command to enable the profile run:
chmod +x /usr/lib/tuned/mssql/tuned.conf tuned-adm profile mssql
Use the following command to check the active profile run:
# tuned-adm active
Additional Resources
Performance best practices and configuration guidelines for SQL Server on Linux