I'm using Debian 8 Linux distribution on 2 different PC configurations. The first configuration you will notice below is the one that I am using for a very long time. This configuration is using 100% cpu at high-peak times, so I decided to buy a new PC with much higher specs. I'm running an old 32bit linux app that has been launched more than 10 years ago, called samp03svr. This is a single-thread app, so I searched only for high frequency CPU. Xeon processors wouldn't help me. The app needs higher CPU frequency than number of cores.

Here are my PC configurations:

  1. An older configuration MotherBoard: ASUS P8H61-M Processor: Intel i5-3570 @ 3.4 GHz RAM: 2x8GB Kingston 1333MHz

  2. A newer configuration MotherBoard: B250M-D3H-CF Processor: i7-7700K CPU @ 4.20GHz RAM: 2x8GB Kingston 2133MHz

What I would expect from the newer configuration is a much lower CPU usage, but, surprise, this is not happening. In fact, the CPU usage is about 5 times higher than the older configuration. The tests I made were done for the same amount of workload, with the same operating system and the same drivers. I tried even to disable multi-thread but there is no CPU usage difference.

What would you recommend to do?

  • Have you tried a newer version of the program? Sounds like the old one may be buggy. – Herb Mar 16 '17 at 10:37
  • 1
    You actually don't need a higher frequency you need a higher amount of instructions per cycle. If you're running the old machine at 100% how can the usage with a newer system be five times higher? – Seth Mar 16 '17 at 10:53
  • Herb Wolfe, there is no newer version of the program. Thanks for your interest. Seth, I can see from single core benchmarks that the i7 has a better score than the i5. I don't understand it's behavior. – Stefan Nechifor Mar 16 '17 at 11:39

If your goal is to meet the demand during the peak times you mention, I would consider, if possible, running the server program on both machines you now have and putting them behind a load balancer, like haproxy.

On the other hand, if your goal is to reduce the CPU consumption of your server program, you have a couple of options.

You can lower the priority of your process so that the kernel will schedule its CPU time in such a way that it does not dominate your CPU. This can be done using the nice or renice commands. On Debian, the priority values range from -20 to +19, and the default value (launching a process without using nice) is 0. The higher the value, the lower the priority will be. It becomes easy to remember if you think of it like "the nicer a process, the more it is willing to give up its CPU time to other processes".

Launch your program like this using different niceness values:

nice -n +12 /path/to/your/program

If your program is already running, you can use renice with its pid:

#first find the pid
pgrep your_program_name
ps aux | grep your_program_name

#now use the pid here
renice -n +12 pid_of_your_program

#or if you are comfortable combining these
renice -n +12 $(pgrep your_program_name)

Another option is using a tool called cpulimit. It lets you run a program and define the maximum percentage of the CPU you want to allow it.

#install the package
apt-get install cpulimit

#run your program, for example limiting to 25%
cpulimit -l 25 /path/to/your/program

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.