0

I have 2 sites on my server (debian) with 4 cpu cores. For both of them I use workers=2 and cpu-affinity=1 so workers are mapped to cpu 0 and 1 for both sites like that:

spawned uWSGI master process (pid: 19345)
spawned uWSGI worker 1 (pid: 19346, cores: 1)
mapping worker 1 to CPUs: 0
spawned uWSGI worker 2 (pid: 19347, cores: 1)
mapping worker 2 to CPUs: 1

I don't want to use 4 workers (obviously, in this case load would spread equally between all cores) to reduce memory usage so I wonder if I can somehow map workers to specific cpu cores? Taking example above, would be nice to have 0 and 1 cpu mapped to workers of the first site and 2 and 3 for the second one.

Also I found some useful (but not enough) info here: http://lists.unbit.it/pipermail/uwsgi/2011-March/001594.html

Thanks.

  • 1
    One word: why? Many people think that CPU pinning is a good thing. It rarely if ever provides any performance increase over just letting the kernel's CPU scheduler do its thing. – EEAA Jun 3 '15 at 22:01
  • 1
    Exactly. The kernel is better at this than you are in almost all cases. – Michael Hampton Jun 3 '15 at 22:05
  • Correct me if I'm wrong but pinning is happening anyway. As I posted, workers are mapped to cpu 0 and 1. For both sites. And they don't switch. So if uWSGI would map them to another that would be nice as load on all cores would be equal. – alTus Jun 3 '15 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.