<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://kb.ettus.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MattProst</id>
		<title>Ettus Knowledge Base - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://kb.ettus.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MattProst"/>
		<link rel="alternate" type="text/html" href="https://kb.ettus.com/Special:Contributions/MattProst"/>
		<updated>2026-06-24T01:10:58Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://kb.ettus.com/index.php?title=USRP_Host_Performance_Tuning_Tips_and_Tricks&amp;diff=5459</id>
		<title>USRP Host Performance Tuning Tips and Tricks</title>
		<link rel="alternate" type="text/html" href="https://kb.ettus.com/index.php?title=USRP_Host_Performance_Tuning_Tips_and_Tricks&amp;diff=5459"/>
				<updated>2022-08-08T15:41:04Z</updated>
		
		<summary type="html">&lt;p&gt;MattProst: /* CPU Governor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Application Note Number==&lt;br /&gt;
'''AN-088'''&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
This application note provides various tips and tricks for tuning your host computer for best performance when working with USRP devices.&lt;br /&gt;
&lt;br /&gt;
==CPU Governor==&lt;br /&gt;
Ensure your CPU governor is set to &amp;lt;code&amp;gt;performance&amp;lt;/code&amp;gt;. This can be done with the Linux utility &amp;lt;code&amp;gt;cpufrequtils&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Install &amp;lt;code&amp;gt;cpufrequtils&amp;lt;/code&amp;gt; with the command below:&lt;br /&gt;
&lt;br /&gt;
    sudo apt install cpufrequtils&lt;br /&gt;
&lt;br /&gt;
You can then set the CPU governor to &amp;lt;code&amp;gt;performance&amp;lt;/code&amp;gt; per core by issuing the command:&lt;br /&gt;
&lt;br /&gt;
    sudo cpufreq-set -c $core_number -g performance&lt;br /&gt;
&lt;br /&gt;
To set the CPU governor to &amp;lt;code&amp;gt;performance&amp;lt;/code&amp;gt; for all cores:&lt;br /&gt;
&lt;br /&gt;
    for ((i=0;i&amp;lt;$(nproc --all);i++)); do sudo cpufreq-set -c $i -r -g performance; done&lt;br /&gt;
&lt;br /&gt;
You can then verify that the CPU governor has been set by running the command:&lt;br /&gt;
&lt;br /&gt;
    cpufreq-info&lt;br /&gt;
&lt;br /&gt;
==Thread Priority Scheduling==&lt;br /&gt;
&lt;br /&gt;
When UHD spawns a new thread, it may try to boost the thread's scheduling priority. If setting the new priority fails, the UHD software prints a warning to the console, as shown below. This warning is harmless; it simply means that the thread will retain a normal or default scheduling priority.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UHD Warning:&lt;br /&gt;
    Unable to set the thread priority. Performance may be negatively affected.&lt;br /&gt;
    Please see the general application notes in the manual for instructions.&lt;br /&gt;
    EnvironmentError: OSError: error in pthread_setschedparam&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To address this issue, non-privileged (non-root) users need to be given special permission to change the scheduling priority. This can be enabled by creating a group &amp;lt;code&amp;gt;usrp&amp;lt;/code&amp;gt;, adding your user to it, and then appending the line &amp;lt;code&amp;gt;@usrp - rtprio  99&amp;lt;/code&amp;gt; to the file &amp;lt;code&amp;gt;/etc/security/limits.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
    sudo groupadd usrp&lt;br /&gt;
    sudo usermod -aG usrp $USER&lt;br /&gt;
&lt;br /&gt;
Then add the line below to end of the file &amp;lt;code&amp;gt;/etc/security/limits.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    @usrp - rtprio  99&lt;br /&gt;
&lt;br /&gt;
You must log out and log back into the account for the settings to take effect. In most Linux distributions, a list of groups and group members can be found in the &amp;lt;code&amp;gt;/etc/group&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
There is further documentation about this in the User Manual at the link below.&lt;br /&gt;
&lt;br /&gt;
* [http://files.ettus.com/manual/page_general.html#general_threading_prio Threading Notes section of the User Manual]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adjust Network Buffers==&lt;br /&gt;
This applies to USRP devices connected via Ethernet, such as the N200, N210, N300, N310, N320, N321, X300, X310, E320.&lt;br /&gt;
&lt;br /&gt;
Note that these settings will not persist across a reboot.&lt;br /&gt;
&lt;br /&gt;
    sudo sysctl -w net.core.wmem_max=33554432&lt;br /&gt;
    sudo sysctl -w net.core.rmem_max=33554432&lt;br /&gt;
    sudo sysctl -w net.core.wmem_default=33554432&lt;br /&gt;
    sudo sysctl -w net.core.rmem_default=33554432&lt;br /&gt;
&lt;br /&gt;
==Adjust Ethernet MTU==&lt;br /&gt;
This applies to Ethernet connected USRPs (N2xx, N3xx, X3xx, E320).&lt;br /&gt;
&lt;br /&gt;
For 1 Gigabit connections, the MTU should be set to &amp;lt;code&amp;gt;1500&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For 10 Gigabit connections, the MTU should be set to &amp;lt;code&amp;gt;9000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It is important to set the value and '''not''' leave it is &amp;lt;code&amp;gt;automatic&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Increasing Ring Buffers==&lt;br /&gt;
This applies to Ethernet connected USRPs using a 10 Gb interface (X3xx, N3xx, E320).&lt;br /&gt;
&lt;br /&gt;
Increasing the Ring Buffers on the NIC may help prevent flow control errors at higher rates.&lt;br /&gt;
&lt;br /&gt;
    sudo ethtool -G &amp;lt;interface&amp;gt; tx 4096 rx 4096&lt;br /&gt;
&lt;br /&gt;
== DPDK == &lt;br /&gt;
DPDK is supported on N3xx, X3xx and E320 USRPs. DPDK replaces the traditional Linux networking stack with a low overhead user-land based driver. Additional details of using DPDK can be found in the UHD Manual located at the following link: https://files.ettus.com/manual/page_dpdk.html &lt;br /&gt;
&lt;br /&gt;
==Disable Hyper-threading==&lt;br /&gt;
In some applications which require the highest possible CPU performance per core, disabling hyper-threading can provide roughly a 10% increase in core performance, at the cost of having less core threads. Hyper-threading can be disabled within the BIOs and varies by  manufacturer.&lt;br /&gt;
&lt;br /&gt;
== Disable KPTI Protections for Spectre/Meltdown==&lt;br /&gt;
In some cases, disabling the KPTI protections for the Linux Kernel can increase performance by 10-15%. It is important to note the ramification making this modification can have. This modification is only recommended for systems that absolutely require the best performance and are not connected to the internet.&lt;br /&gt;
&lt;br /&gt;
* https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)&lt;br /&gt;
* https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)&lt;br /&gt;
&lt;br /&gt;
Disabling KPTI protections can be done by adding the lines below to your &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt; file at &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    pti=off spectre_v2=off l1tf=off nospec_store_bypass_disable no_stf_barrier&lt;br /&gt;
&lt;br /&gt;
After modifying the &amp;lt;code&amp;gt;grub&amp;lt;/code&amp;gt; file, run the following command to update your configuration and reboot:&lt;br /&gt;
&lt;br /&gt;
    sudo update-grub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Application Notes]]&lt;/div&gt;</summary>
		<author><name>MattProst</name></author>	</entry>

	</feed>