I'm a little confused with what I'm seeing with a node process that I have running. docker stats
on the host is showing that the container is using over 100% CPU. This makes me think that the node process is maxing out the CPU. This is confirmed when I run top
on the host and see that the node process is using over 100% CPU.
When I jump into the docker container I see that node is only using 54% of the CPU and that the processing is split between the two cores. I was expecting to see one core maxed out and the other at 0 since Node is single-threaded.
I found this QA and it looks like the OS could be moving the process between the cores (news to me). Is This Single Node.JS App Using Multiple Cores?
Can you help me interpret the results? Is node pretty much maxed out? Or since the process in the container is showing 54% usage can that go up to 100%? Why is the top in the node container showing 54% usage for node but 45% + 46% for both cores. Nothing is running in the container but the single node process. I'm not using clustering although maybe a package I have included is.
I'm asking all this as I'm trying to understand if I should be scaling this ECS instance out or if node can handle more.
Node.JS: 15.1.0
EC2 Instance: c5.large
NestJS: 7.3.1