<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>performance &#8211; richliu&#039;s blog</title>
	<atom:link href="https://blog.richliu.com/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Wed, 19 May 2021 01:54:34 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>ARM64 Linux Performance Tuning</title>
		<link>https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/</link>
					<comments>https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 19 May 2021 01:54:33 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[performance]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4477</guid>

					<description><![CDATA[<p>This is personal notebook for ARM64 performance tuning. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/">ARM64 Linux Performance Tuning</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This is personal notebook for ARM64 performance tuning.</p>



<span id="more-4477"></span>



<h2 class="wp-block-heading">NVME 4K Write Performance</h2>



<p>Situation: <br />Run fio 4K write on 24 NVME drivers, but some drivers might not get higher IOPS performance</p>



<p>Solution:<br />It should be caused by enable SMMU, so, if doesn&#8217;t use VM, just disable iommu to get better performance<br />Add iommu.passthrough=1</p>



<h2 class="wp-block-heading">General IO performance Tuning </h2>



<p>For high bandwidth card, most time it needs to disable irq_balancing <br />$ systemctl stop irqbalance.service</p>



<h2 class="wp-block-heading">Some Performance Tuning Parameters</h2>



<pre class="wp-block-preformatted">ulimit -s unlimited 
ulimit -l 2097152 
echo 8 | sudo tee /proc/sys/vm/dirty_ratio 
echo 1 | sudo tee /proc/sys/vm/swappiness 
echo 1 | sudo tee /proc/sys/vm/zone_reclaim_mode 
echo 3 | sudo tee /proc/sys/vm/drop_caches 
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space 
echo 0 | sudo tee /proc/sys/kernel/numa_balancing 
echo never > /sys/kernel/mm/transparent_hugepage/enabled 
cpupower frequency-set -g performance 
export MALLOC_CONF=thp:always
 
</pre>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/">ARM64 Linux Performance Tuning</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Intel Coffee Lake Ubuntu Linux 速度太慢</title>
		<link>https://blog.richliu.com/2021/04/15/4455/intel-coffee-lake-ubuntu-linux-%e9%80%9f%e5%ba%a6%e5%a4%aa%e6%85%a2/</link>
					<comments>https://blog.richliu.com/2021/04/15/4455/intel-coffee-lake-ubuntu-linux-%e9%80%9f%e5%ba%a6%e5%a4%aa%e6%85%a2/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 15 Apr 2021 14:15:37 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[Frequency]]></category>
		<category><![CDATA[governors]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[powersave]]></category>
		<category><![CDATA[pstate]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4455</guid>

					<description><![CDATA[<p>這個也是怪自己，最近因為 Windows VM 不知道為什麼速度變很慢，所以改用 Linux 跑 VM ，雖然 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/04/15/4455/intel-coffee-lake-ubuntu-linux-%e9%80%9f%e5%ba%a6%e5%a4%aa%e6%85%a2/">Intel Coffee Lake Ubuntu Linux 速度太慢</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>這個也是怪自己，最近因為 Windows VM 不知道為什麼速度變很慢，所以改用 Linux 跑 VM ，雖然 Linux 下 VM 速度比 Windows 快，但是整體的感覺還是慢．本來以為是我的 i5-9600k VM 表現不好，但是看著 CPU utilization 感覺還是怪</p>



<span id="more-4455"></span>



<p>先說結論，現在新的 CPU Linux 下預設會使用 pstate 做為主要的電源控制，而且會覆寫掉其他的設定，也包含 BIOS 的設定．而在我的 Ubuntu 系統下，pstate 預設是 powersave mode ，而且在 pstate 下只有 powersave 和 performance 兩個模式．</p>



<pre class="wp-block-code"><code>$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors 
powersave performance
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 
powersave</code></pre>



<p>理論上應該切 performance 模式效能就會回來，但是我們是愛好地球的好公民，當然是要用 ondemand 模式（謎之音，你怎麼知道 performance 不會變 ondemand mode 呢？答曰：是不知，懶得測）<br /><br />要 disable Intel pstate 也很簡單，編輯 /etc/default/grub ，在GRUB_CMDLINE_LINUX_DEFAULT 加上</p>



<pre class="wp-block-preformatted">intel_pstate=disable</pre>



<p>然後再執行</p>



<pre class="wp-block-preformatted">update-grub2</pre>



<p>接下來重新開機就就可以了<br /><br />開機完檢查目前的設定，ondemand ，正是我們要的，速度就變得飛快了，這才是正常的 Linux 速度</p>



<pre class="wp-block-code"><code>$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors conservative ondemand userspace powersave performance schedutil
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 
ondemand</code></pre>



<p>更新，因為看到 schedutil 的效能更好，所以也想要將預設的 governor 設定成 schedutil <br />在 ubuntu 下執行以下命令</p>



<pre class="wp-block-code"><code>sudo apt-get install cpufrequtils
echo 'GOVERNOR="schedutil"' | sudo tee /etc/default/cpufrequtils
sudo systemctl disable ondemand</code></pre>



<p>重開機應該就可以了，如果不想重開機想要馬上更新，可以下</p>



<pre class="wp-block-code"><code>echo "schedutil" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor </code></pre>



<p>ref.<br /><a href="https://wiki.archlinux.org/index.php/CPU_frequency_scaling" target="_blank" rel="noreferrer noopener">CPU frequency scaling</a><br /><a href="https://askubuntu.com/questions/1021748/set-cpu-governor-to-performance-in-18-04" target="_blank" rel="noopener">Set CPU governor to performance in 18.04</a><br /><a href="https://www.phoronix.com/scan.php?page=article&amp;item=amd-linux511-perfgov&amp;num=1" target="_blank" rel="noreferrer noopener">AMD Schedutil vs. Performance Governor Benchmarks On Linux 5.11 Shows More Upside Potential</a></p>



<p>後記，今天到公司連到我自己的 Dell Notebook ，發現也是同樣的狀況，直接試了一下改 performance 之後是不是像 ondemand 一樣的行為</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1674" height="314" src="https://blog.richliu.com/wp-content/uploads/2021/04/image.png" alt="" class="wp-image-4458" srcset="https://blog.richliu.com/wp-content/uploads/2021/04/image.png 1674w, https://blog.richliu.com/wp-content/uploads/2021/04/image-600x113.png 600w, https://blog.richliu.com/wp-content/uploads/2021/04/image-768x144.png 768w, https://blog.richliu.com/wp-content/uploads/2021/04/image-1536x288.png 1536w" sizes="(max-width: 1674px) 100vw, 1674px" /><figcaption>governor = powersave</figcaption></figure>



<p>然後下指令改到 performance mode</p>



<pre class="wp-block-code"><code># echo "performance" &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance
</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" width="1672" height="624" src="https://blog.richliu.com/wp-content/uploads/2021/04/image-1.png" alt="" class="wp-image-4459" srcset="https://blog.richliu.com/wp-content/uploads/2021/04/image-1.png 1672w, https://blog.richliu.com/wp-content/uploads/2021/04/image-1-600x224.png 600w, https://blog.richliu.com/wp-content/uploads/2021/04/image-1-768x287.png 768w, https://blog.richliu.com/wp-content/uploads/2021/04/image-1-1536x573.png 1536w" sizes="(max-width: 1672px) 100vw, 1672px" /><figcaption>governor = performance</figcaption></figure>



<p>下了二次察看都是 4G 的 Frequency ，而這一台 Notebook 沒有執行什麼特別的任務，所以 governor = performance 不是我要的結果<br /><br />Intel pstate 我真是搞不懂你，我開始懷疑我 Windows 筆電慢也是因為 pstate 了<br /><br />關掉 pstate 重開機預設就是 ondemand ，這個就是我們要的結果了，會隨系統負載修改時脈</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1681" height="903" src="https://blog.richliu.com/wp-content/uploads/2021/04/image-2.png" alt="" class="wp-image-4462" srcset="https://blog.richliu.com/wp-content/uploads/2021/04/image-2.png 1681w, https://blog.richliu.com/wp-content/uploads/2021/04/image-2-600x322.png 600w, https://blog.richliu.com/wp-content/uploads/2021/04/image-2-768x413.png 768w, https://blog.richliu.com/wp-content/uploads/2021/04/image-2-1536x825.png 1536w" sizes="(max-width: 1681px) 100vw, 1681px" /><figcaption>governor = ondemand </figcaption></figure>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/04/15/4455/intel-coffee-lake-ubuntu-linux-%e9%80%9f%e5%ba%a6%e5%a4%aa%e6%85%a2/">Intel Coffee Lake Ubuntu Linux 速度太慢</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2021/04/15/4455/intel-coffee-lake-ubuntu-linux-%e9%80%9f%e5%ba%a6%e5%a4%aa%e6%85%a2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
