I have a DigitalOcean droplet on which I have deployed a Docker container (Docker version: 20.10.14), but my app is sometimes slow, therefore I would like to allocate more resources to it.
The droplet has 16 CPUs. When I run docker stats, I can see that my container's CPU usage averages 120-140%.
When I monitor my droplet's CPU usage, I can see it's at 8%, which is coherent with my container's CPU usage: 130% /(16 * 100%) is roughly 8%.
I have used docker update to make sure that --cpus is at 16 and --cpuset-cpus is at "0-15" for my container, but what else could I do to make sure that my container makes full use of the droplet's resources?
Thank you!
-
2Is your app able to use more than one core?Stack Exchange Broke The Law– Stack Exchange Broke The Law2023年04月05日 22:58:51 +00:00Commented Apr 5, 2023 at 22:58
1 Answer 1
Usually docker container resources are not limited by default. You have to explicitly ask for stricter limits. Without more information, my guess would be that the problem is in your app, not in docker. It can be tricky to make an app CPU bound. Your IO needs to be fast enough. You need adequate buffering. You need tuning of concurrency and threading. Throwing more resources at a problem can only take you so far.
-
Keeping 16 cores at 3 GHz fed with 64 bits of new data every clock cycle is on the order of terabits per second. Sure, you're not processing completely new data every cycle, and not all your cores are running at 3 GHz, but that gives you an idea of how much I/O you need.Jörg W Mittag– Jörg W Mittag2023年04月06日 07:35:53 +00:00Commented Apr 6, 2023 at 7:35