Report this

What is the reason for this report?

How to make Dedicated CPUs yield consistent run time?

Posted on January 21, 2022

Hi,

I’m running an online judge on the CPU-optimized server. I have 4 judges, each judge is running with 2 different vCPUs (I assign the CPUs via Docker)

I noticed that if more than one of them is judging, their judging time will increase about 10~30% (compare to when there is only one of them is running). Also, note that the judging process usually raises the CPU consumption to 100% for 30~60 seconds.

I know that Dedicated CPUs are still hyperthread(s), that is why I assign 2 vCPUs for each judge (so I think 2 vCPU is on the same physical CPU core, correct me if I’m wrong). However, I expected that the judging time should be consistent.

So I wonder, does the Dedicated CPUs run slower if others CPUs are on heavy load?

Because the online judge should not yield inconsistent results, how can I make the CPUs yield consistent run time?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Dedicated CPUs with DigitalOcean should not slow down under heavy load. However, there could be several factors that could lead to such a situation. The Docker’s CPU share management or the nature of your workloads might be leading to inconsistent results.

When multiple processes are running and competing for CPU time, the CPU scheduler will need to divide the available CPU time among them. This can lead to varying execution times. Therefore, for consistent results, consider isolating your judge instances as much as possible. You could try running each judge on its own Droplet, or adjusting your Docker CPU assignment.

If you’re still interested in diving deeper into Docker’s CPU management, here’s a Docker’s resource management guide.

To better understand CPU-optimized droplets, have a look at the official DigitalOcean Droplets documentation.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.