Linux CentOS Distribution One of the most popular Linux distributions today, CentOS stands for Community ENTerprise Operating System. The core of CentOS Linux is derived from Red Hat Enterprise Linux, or RHEL, and is therefore fully RHEL compatible. Unlike commercial RHEL, CentOS is a free Linux distribution. CentOS is supported by Communities and you only need to get your help and support from these public communities and you do not have to pay any fees. In this article, we try to teach you Performance tuning and optimize CentOS 7. You can select and purchase your CentOS VPS server from the packages available in Eldernode.
Table of Contents
Performance tuning and optimize CentOS 7
To increase the performance of services, applications and databases on a server, a series of custom performance settings are performed using a variety of tools. This tutorial will explain how to tune and optimize CentOS 7.
What is Tuned and what does it do?
Tuned will not dynamically adjust system settings. You can modify how the tuned daemon operates and allow it to dynamically alter settings based on system usage. You can also use the tuned-adm command-line tool to manage the daemon once it is running.
Generally, tuning is a powerful daemon for dynamically auto-tuning Linux server performance based on the information it gathers from monitoring the use of system components, to squeeze maximum performance out of a server. Tuned does this by tuning system settings dynamically on the fly depending on system activity, using tuning profiles.
The tuned tuning service can adapt the operating system to perform better under certain workloads by setting a tuning profile. The tuned-adm command-line tool allows users to switch between different tuning profiles. Tuning profiles include sysctl configs, disk-elevators configs, transparent huge pages, power management options, and custom scripts.
Tuned Profiles Overview
Several pre-defined profiles are included for common use cases, but tuned also enables you to define custom profiles, which can be either based on one of the pre-defined profiles or defined from scratch. The profiles provided with tuned are divided into two categories: power-saving profiles, and performance-boosting profiles.
The performance-boosting profiles include profiles focus on the following aspects:
– Low latency for storage and network
– High throughput for storage and network
– Virtual machine performance
– Virtualization host performance
Performance tuning and optimize CentOS 7
In the continuation of this article, we will teach you how to install tuned on CentOS 7 and also how to Create Custom tuning profiles. Please be with us.
Tutorial Install Tuned on CentOS 7
Note: On CentOS 7, tuned comes pre-installed and activated by default, but in the older version of CentOS, you need to install it using the following command:
yum install tuned
After installation you can see the following configuration files:
/etc/tuned – tuned configuration directory.
/etc/tuned/tuned-main.conf– tuned mail configuration file.
/usr/lib/tuned/ – stores a sub-directory for all tuning profiles.
It’s time to manage the tuned service on CentOS 7 using the following commands:
systemctl start tuned
systemctl enable tuned
systemctl status tuned
systemctl stop tuned
You should now be able to control the settings using the Tunde-adm tool. You can check the currently active profile with the following command.
Note: There are a number of predefined tuning profiles already included for some common use cases.
tuned-adm active
You can get a list of available tuning profiles using the following command line:
tuned-adm list
Use the following command to move to any of the profiles on common server loads:
tuned-adm profile throughput-performance tuned-adm active
You can also use the recommended profile for your system using the following command:
tuned-adm recommend
Finally, you can disable the settings with the following command:
tuned-adm off
Learn how to Create Custom Tuning Profiles on CentOS 7
In the continuation of this tutorial, by giving an example of how to create a new profile called test-performance, we will show that you can also create new profiles. This profile will use latency-performance settings. Follow these steps:
1. Go to the path which stores sub-directories for all tuning profiles.
2. Create a new sub-directory called test-performance for your custom tuning profile.
cd /usr/lib/tuned/ mkdir test-performance
3. To create a tuned.conf configuration file in the category, use the following command:
vim test-performance/tuned.conf
4. Put the following instructions in the file and then save it:
[main] include=latency-performance summary=Test profile that uses settings for latency-performance tuning profile
5. Now you can activate the new tuned profile with the help of the following command:
tuned-adm profile test-performance
Latency-performance for CentOS 7
– Profile for low latency performance tuning.
– Disables power-saving mechanisms.
– CPU governor is set to performance and locked to the low C states (by PM QoS).
– CPU energy performance bias to performance.
– This profile is the Parent profile to “network-latency”.
You can activate tuned latency-performance for CentOS 7 using following command:
tuned-adm profile latency-performance
For CentOS 7, the latency-performance profile includes the following tweaks:
cat /usr/lib/tuned/latency-performance/tuned.conf
[cpu]
force_latency=1
governor=performance
energy_perf_bias=performance
min_perf_pct=100
[sysctl]
kernel.sched_min_granularity_ns=10000000
vm.dirty_ratio=10
vm.dirty_background_ratio=3
vm.swappiness=10
kernel.sched_migration_cost_ns=5000000
Conclusion
At the beginning of this article we explained the introduction of tuned and its applications. Then we reviewed the tuned profiles and then tried to teach you how to install tuned and how to create Custom Tuning Profiles on CentOS 7.