24/7 ACTIVE THREAT INTELLIGENCE & NODE TELEMETRY MON - FRI: 10AM - 5PM
Home / Blog / Web3 & Blockchain

How to Improve CPU execution time on your Antelope node

How to Improve CPU execution time on your Antelope node

The CPU governor is a crucial component that regulates the CPU's frequency and power usage. By default, Linux servers often use the "ondemand" governor, which dynamically adjusts the CPU frequency based on system load. However, for maximum performance, switching to the "performance" governor is recommended.

To check your current CPU governor, use the following command:

command
sudo apt-get install cpufrequtils

Then run:

command
cpufreq-info

This command will display information about the current CPU frequency scaling settings. Look for the "governor" section to identify the current governor.

To set the CPU governor to "performance," execute the following command:

command
sudo cpufreq-set -r -g performance

This command ensures that all CPU cores are set to the "performance" governor, optimizing the server for maximum processing power.

If this doesn't work for you, you can try this command:

command
echo 'performance' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Monitoring CPU Clock Speed:

To monitor the current CPU clock speed in real-time, you can use the following command:

command
watch -n 0.4 "grep -E '^cpu MHz' /proc/cpuinfo"

This command uses the watch utility to continuously display the CPU clock speed, updating every 0.4 seconds. It provides valuable insights into how the CPU frequency changes under different workloads.

Disabling Multiple Cores:

In specific scenarios, you might want to disable all but one processor core to dedicate resources to a particular task. To achieve this, you can use the following steps:

Identify the number of available CPU cores:

command
lscpu

Look for the "Core(s) per socket" entry to determine the number of cores per CPU socket.

Disable additional cores, leave only one core:

command
for cpu in /sys/devices/system/cpu/cpu[1-9]*; do echo 0 | sudo tee "$cpu/online"; done

To make sure that after reboot, your governor stays in perfromance mode you will need to create reboot cronjob:

terminal / code
sudo crontab -e

Then add the following content:

command
@reboot echo 'performance' | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Save and exit (press CTRL+X, then Y, then ENTER).

Keep in mind that you need to leave at least one core for the best performance. Use htop command to see how many cores are working.

← PREVIOUS ARTICLE
Clipboard-injector attacks target cryptocurrency users in copy-paste heists
NEXT ARTICLE →
What is DNS and how it works?