--- tags: Kernel description: Linux Kernel tunning for lazzy people like me. robots: index, follow --- # 懶人的Linux效能調校-tuned :::info 1. sles 12、15的安裝方式沒什麼差異,config也可以另外依照自己所需要的狀況調整,不見得100%全部都要照預設的組態檔套用。 2. 效能調校非常吃硬體、韌體、OS調教、檔案系統、應用程式、網路,請不要追尋極限,沒有意義。 ::: ## 1. 安裝套件 ```shell! linux-aier:~ # zypper se tuned Refreshing service 'SUSE_Linux_Enterprise_Server_12_SP5_x86_64'. Warning: The gpg key signing file 'repomd.xml' has expired. Repository: SLES12-SP5-Pool Key Name: SuSE Package Signing Key <build@suse.de> Key Fingerprint: FEAB5025 39D846DB 2C0961CA 70AF9E81 39DB7C82 Key Created: Wed 07 Dec 2016 06:57:35 PM CST Key Expires: Sun 06 Dec 2020 06:57:35 PM CST (EXPIRED) Rpm Name: gpg-pubkey-39db7c82-5847eb1f Building repository 'SLES12-SP5-Pool' cache .............................................................................[done] Retrieving repository 'SLES12-SP5-Updates' metadata .....................................................................[done] Building repository 'SLES12-SP5-Updates' cache ..........................................................................[done] Loading repository data... Reading installed packages... S | Name | Summary | Type --+-------+-----------------------------------------+----------- | tuned | A dynamic adaptive system tuning daemon | package | tuned | A dynamic adaptive system tuning daemon | srcpackage linux-aier:~ # zypper in tuned Refreshing service 'SUSE_Linux_Enterprise_Server_12_SP5_x86_64'. Loading repository data... Reading installed packages... Resolving package dependencies... The following 4 NEW packages are going to be installed: python-configobj python-decorator python-pyudev tuned 4 new packages to install. Overall download size: 379.6 KiB. Already cached: 0 B. After the operation, additional 1.8 MiB will be used. Continue? [y/n/...? shows all options] (y): y Retrieving package python-decorator-4.1.2-4.4.2.noarch (1/4), 23.0 KiB ( 57.6 KiB unpacked) Retrieving: python-decorator-4.1.2-4.4.2.noarch.rpm .....................................................................[done] Retrieving package python-pyudev-0.16.1-3.2.1.noarch (2/4), 165.3 KiB (959.1 KiB unpacked) Retrieving: python-pyudev-0.16.1-3.2.1.noarch.rpm .......................................................................[done] Retrieving package python-configobj-5.0.6-20.8.1.noarch (3/4), 55.0 KiB (360.3 KiB unpacked) Retrieving: python-configobj-5.0.6-20.8.1.noarch.rpm ....................................................................[done] Retrieving package tuned-2.4.1-18.3.1.noarch (4/4), 136.3 KiB (415.4 KiB unpacked) Retrieving: tuned-2.4.1-18.3.1.noarch.rpm ...............................................................................[done] Checking for file conflicts: ............................................................................................[done] (1/4) Installing: python-decorator-4.1.2-4.4.2.noarch ...................................................................[done] (2/4) Installing: python-pyudev-0.16.1-3.2.1.noarch .....................................................................[done] (3/4) Installing: python-configobj-5.0.6-20.8.1.noarch ..................................................................[done] (4/4) Installing: tuned-2.4.1-18.3.1.noarch .............................................................................[done] ``` ## 2. 啟動服務 ```shell= linux-aier:~ # systemctl enable --now tuned Created symlink from /etc/systemd/system/multi-user.target.wants/tuned.service to /usr/lib/systemd/system/tuned.service. linux-aier:~ # systemctl status tuned ● tuned.service - Dynamic System Tuning Daemon Loaded: loaded (/usr/lib/systemd/system/tuned.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2023-08-30 22:08:33 CST; 5s ago Main PID: 2865 (tuned) Tasks: 5 (limit: 512) CGroup: /system.slice/tuned.service └─2865 /usr/bin/python -Es /usr/sbin/tuned -l -P Aug 30 22:08:32 linux-aier systemd[1]: Starting Dynamic System Tuning Daemon... Aug 30 22:08:33 linux-aier systemd[1]: Started Dynamic System Tuning Daemon. ``` ## 3. 尋找組態檔 安裝mlocate與更新index ```shell= linux-aier:~ # zypper in mlocate Refreshing service 'SUSE_Linux_Enterprise_Server_12_SP5_x86_64'. Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: mlocate 1 new package to install. Overall download size: 63.5 KiB. Already cached: 0 B. After the operation, additional 143.4 KiB will be used. Continue? [y/n/...? shows all options] (y): y Retrieving package mlocate-0.26-12.1.x86_64 (1/1), 63.5 KiB (143.4 KiB unpacked) Retrieving: mlocate-0.26-12.1.x86_64.rpm ................................................................................[done] Checking for file conflicts: ............................................................................................[done] (1/1) Installing: mlocate-0.26-12.1.x86_64 ..............................................................................[done] Additional rpm output: Updating /etc/sysconfig/locate... linux-aier:~ # updatedb ``` 尋找組態,15可能會遇到缺組態的問題 ```shell= linux-aier:~ # locate throughput-performance /usr/lib/tuned/throughput-performance /usr/lib/tuned/throughput-performance/tuned.conf ``` ## 4. 查詢與套用throughput-performance組態 ```shell= linux-aier:~ # tuned-adm recommend balanced linux-aier:~ # tuned-adm active Current active profile: balanced linux-aier:~ # tuned-adm list Available profiles: - balanced - desktop - latency-performance - network-latency - network-throughput - powersave - throughput-performance - virtual-guest - virtual-host Current active profile: balanced linux-aier:~ # tuned-adm profile throughput-performance linux-aier:~ # tuned-adm active Current active profile: throughput-performance ``` ## 5. 效能測試工具 :::info 1. [openbenchmarking](https://openbenchmarking.org/) 2. 上面這個就很多了,還跑分呢。 ::: ## extra-1. 找不到組態?! ```shell= linux-aier:/usr/lib/tuned # pwd /usr/lib/tuned linux-aier:/usr/lib/tuned # ls -al total 28 drwxr-xr-x 1 root root 354 Aug 30 22:08 . drwxr-xr-x 1 root root 16948 Aug 30 22:08 .. drwxr-xr-x 1 root root 20 Aug 30 22:08 balanced drwxr-xr-x 1 root root 20 Aug 30 22:08 desktop -rw-r--r-- 1 root root 12151 Dec 4 2019 functions drwxr-xr-x 1 root root 20 Aug 30 22:08 latency-performance drwxr-xr-x 1 root root 20 Aug 30 22:08 network-latency drwxr-xr-x 1 root root 20 Aug 30 22:08 network-throughput -rwxr-xr-x 1 root root 3719 Jul 22 2014 pmqos-static.py -rw-r--r-- 1 root root 4136 Dec 4 2019 pmqos-static.pyc drwxr-xr-x 1 root root 38 Aug 30 22:08 powersave -rw-r--r-- 1 root root 601 Oct 17 2014 recommend.conf drwxr-xr-x 1 root root 20 Aug 30 22:17 throughput-performance drwxr-xr-x 1 root root 20 Aug 30 22:08 virtual-guest drwxr-xr-x 1 root root 20 Aug 30 22:08 virtual-host ``` ## extra-2. 套用組態錯誤?! :::info 會發生在15版,沒有正確套用的組態檔會被放在 /etc/tuned/ 中,修正之後重新profile就好囉。 :::
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up