by Wander Boessenkool (Red Hat)
Tuning systems can be a time consuming art. Not only does it involve extensive profiling of your systems, as well as continuous monitoring, but keeping tuning setting applied continuously can be quite a chore as well. Especially if the tuning needs of your systems change throughout the day.
Imagine a database system that is used to process orders from customers. In this specific system orders come in in bulk between 08:00 and 18:00, but the other 14 hours in a day and during the weekends the machine is mostly idling. We could tune this system for power efficiency, so as not to waste to much energy during the 118 hours a week it is doing almost nothing, or we could tune it for peak performance during the 50 hours a week the system is heavily utilized.
With a traditional setup switching between those two extremes would be either very cumbersome, with an administrator having to make those changes by hand, or it would require extensive scripting and testing to automate.
Introducing Tuned, the Automatic Tuning Daemon
With the release of Red Hat Enterprise Linux 6 a third solution has become available: tuned
. tuned
is a system service that lets you select a tuning profile from one of the nine profiles shipped with Red Hat Enterprise Linux 6, or any that you've written yourself. Tuning profiles include sysctl
settings (/proc/sys/
), settings for disk-elevators, power management options, transparent hugepages, and any scripts that you might want to add yourself.
Switching between profiles with tuned
only takes one command, and as such this makes it a prime candidate for inclusion in cron jobs. In the example above we could configure a cron job to switch to a maximum performance profile on weekdays at 08:00, and then back to maximum power savings on weekdays at 18:00.
Installing and configuring Tuned
To start using tuned
we will first need to install the packages for it:
[root@server ~]# yum install tuned
After the packages are installed we can query the status of the tuning daemons using the tuned-adm active
command:
[root@server ~]# tuned-adm active Current active profile: off Service tuned: disabled, stopped Service ktune: disabled, stopped
As we can see in the output above we haven't yet selected a tuning profile, and both the daemons (tuned
and ktune
) are stopped, and not configured to start at system boot.
To view a list of available tuning profiles you can use the tuned-adm list
command:
[root@server ~]# tuned-adm list Available profiles: - desktop-powersave - enterprise-storage - server-powersave - default - throughput-performance - laptop-battery-powersave - spindown-disk - latency-performance - laptop-ac-powersave Current active profile: off
Let's say that we are interested in the throughput-performance
profile. Selecting a profile can be done with the tuned-adm profile
command:
[root@server ~]# tuned-adm profile throughput-performance
Running the command tuned-adm active
now gives us some new output:
[root@server ~]# tuned-adm active Current active profile: throughput-performance Service tuned: enabled, running Service ktune: enabled, running
Not only did the tuned-adm profile
command set our profile choice, it also started the daemons for us and enabled the daemons to start at boot.
If at any time you want to completely disable the tuning daemon you can do so by running the command tuned-adm off
:
[root@server ~]# tuned-adm off
This will not only revert all your settings to what they were before tuned
started, it will also disable the tuning services from running at boot.
With this information in mind the example in our introduction can be implemented by creating a new file in /etc/cron.d
, let's call it /etc/cron.d/tuning
0 8 * * 1-5 /usr/bin/tuned-adm profile throughput-performance 0 18 * * 1-5 /usr/bin/tuned-adm profile server-powersave
With these cron jobs in place our server will switch to a maximum throughput profile every weekday at 08:00, and back to a power saving profile weekdays at 18:00.
Creating Tuning Profiles
If you want to go beyond the nine profiles shipped with tuned
you can create your own. All tuning profiles get their own sub-directory under /etc/tune-profiles
, and creating a new one is as easy a copying an existing one. For example let's say that we want to base a new profile of the the existing server-powersave
profile:
[root@server ~]# cd /etc/tune-profiles [root@server tune-profiles]# cp -av server-powersave my-powersave
Inside your new directory you should now find four files:
-
tuned.conf
: In this file you can enable/disable the three main tuned plugins (disk, network, and CPU). When enabled these plugins will monitor your system and switch to power saving mode for their respective subsystems whenever that subsystem has a low load. -
ktune.sysconfig
: In this file you can enable/disable the use ofktune
and set a disk elevator to be used for your hard drives. Disk elevators are the queuing algorithms used fo re-ordering and merging requests send to a disk. -
sysctl.ktune
: In here you can changesysctl
settings. Bear in mind that when a profile is activated the settings from/etc/sysctl.conf
will also be applied after this file has been parsed. -
ktune.sh
: In this script you should have two functions:start() {}
andstop() {}
. Thestart
function will be called when the profile is activated (also on boot), and thestop
function will be called when we de-activate this profile.ktune.sh
should always source the file/etc/tune-profiles/functions
, which provides you with a lot of utility functions for power management, disk tuning, enabling and disabling transparent hugepages, etc. One of the most important functions in this file isprocess
, which is usually called likeprocess ${@}
at the end of yourktune.sh
script. Theprocess
function has all the default logic in it for handling starting, stopping, and restarting your profile.
저자 소개
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.