I'm running online servers for a physics-based game with a backend in Node.js. Currently, the server can handle 10 games/worlds at a time before the next tick needs to be executed.

With this in mind, I have tight scheduling using nanotimer so that the world steps don't step on each other's toes, but the ordering also means that I can only run on one processor, so my AWS instances are only sitting at about 55% CPU utilization.

I decided using taskset would be a good way of going about using both processors on my instance, but sometimes the worlds are blocked from processing for several seconds at times by what I imagine is another exterior process running.

How can I prevent this from happening? If I'm using two of the processors (without taskset), the one set of worlds runs just fine, but I'm only using 55% of my processor, which is really expensive.


I would check out the priority of processes running on the servers, as the first thing.

ps -eo pid,ppid,ni,comm

Then I would change the nice value to the highest on your node.js process to see if there was any improvement.

renice -n -12 -p (PID of your node.js)

  • Interesting, thanks. I will get back to see if this helps at all. – DonutGaz Mar 17 at 19:35
  • Hey Mark, gave this a shot. Unfortunately since both processes run at 100% CPU utilization, they seemed to really clobber the system and lag incredibly. I'll be revisiting this at a later point. – DonutGaz Mar 18 at 4:42

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.