I'm facing a somewhat weird phenomenon I can't explain regarding to CPU/core usage. I run a couple of Docker containers on an Ubuntu machine with OpenPLC running inside the containers. The only interesting part to know about this is that when I redeploy to that PLC it runs the g++ compiler to recompile a program. I have one extra container that controls these redeployments.

So if I redeploy my program to 4 containers, 4 g++ processes will spawn and do work. Around the 4 PLC mark my i3-2310M CPU has all cores at 100%. Here I have a graph with number of containers I deploy to and the time it takes to receive data again when they're done redeploying.

graph of latency per number of PLC's These are means of 5 test runs and the error bars signify standard error. It's obvious that the time should increase as more g++ processes run, but the way it increases is something I can't explain. I would have expected linear increase.

These PLC containers send Modbus/TCP packets to the controlling container and I measure the time with Wireshark between the last message before redeploying and the first message after.

Any possible explanations for this weird pattern?

  • At around 3 of 4 PLC's I'm seeing all cores are at 100%. I see the same behaviour when turning off hyper-threading. May 11, 2017 at 18:11

1 Answer 1


Your processor has two cores. So 1 and 2 PLCs take the same amount of time.

Other than that, it is pretty much linear. There's one line that includes all the even numbers (where both cores are busy) and one that includes all the odd ones (where one core sometimes has no work to do because there's only one job left).

The two lines converge because with enough PLCs, you are able to keep both cores busy almost all of the time.

  • That seems like a logical explanation, but both cores are always 100% busy. I don't think your answer takes this into account, right? May 11, 2017 at 18:24
  • As the numbers get larger, you are able to keep both cores busy a higher and higher percentage of the time. Are you seeing both cores always 100% busy at 3? May 11, 2017 at 18:38
  • At 3 they are very high in the 90's but not exactly all 4 constantly at 100%. From 4-5 on it's always 100%. May 11, 2017 at 18:52
  • @CedricVandendriessche Right, and you'll notice the odd/even effect drops to very little around there too. May 11, 2017 at 18:54

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.