Jump to content

Docker CPU Core/Threading Usage


Phrendo

Recommended Posts

Hello All, 

 

My question is really about what the docker is allowed to utilize as far as CPU cores are concerned. 

 

I have a running SQL Server in a container. I am currently running a fairly intensive process within SQL.  I would expect the CPU of the container to be near 100%.  My problem is that it appears to only be using one core of the host at a time.

 

image.png.baaefcef52271249aa87b3da9691bbaa.png

 

I have edited the CPU pinning within the Docker Config (tried All On,  All On except 0,1), but get the same result.  To be clear, I want to allocate as much CPU to my SQL Server as possible.  The version of SQL server that I am using within the container does allow multi-core usage.

 

Any help would be very much appreciated!

 

Link to comment
20 hours ago, Phrendo said:

I have edited the CPU pinning within the Docker Config (tried All On,  All On except 0,1), but get the same result.  To be clear, I want to allocate as much CPU to my SQL Server as possible.  The version of SQL server that I am using within the container does allow multi-core usage.

Are you running VM's?  Have you isolated cores to the VM's?  Best way to give as much CPU to any given container is not not pin it to anything at all.

 

Now, if you've isolated CPU cores for VMs, then the containers will only run on the non-isolated cores, and if you try and pin a container to multiple isolated cores then it will only ever run on the lowest numbered one.

Link to comment

Thanks for the response @Squid.  Regarding the CPU Pinning, I tried every variation, all while have the VM service turned off.  I did figure it out though.

 

The SQL procedure that I was testing with was forcing a single thread.  Right now, I have the Docker pinned to the 6 cores (no HT) and I am running 6 instances of the SQL procedure.  As you can see in the image below, it is in fact properly using the pinned CPUs (always was).  It is odd that the docker stats command reports a sum of all cores on the CPU % though (this is what was throwing me off earlier).

 

 

image.png.35ae3f259743ad49381bd8899b4b06d3.png

 

 

Again, thank you for the response.

Link to comment

That % is actually quite normal.  By default (and convention in Linux), the percentages reported by each core are added up.   (Note that on the docker page itself (Advanced view), those percentages are normalized to be 0-100, so that page would be showing you 50% - although I can't remember if it takes into consideration the pinned cores or not so it might show 100%)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...