Search code examples
pythonuwsgihyperthreading

Django + Uwsgi + CPU Hyperthread would this have advantage on parallelism?


Lets say I have a django project running on uwsgi emperor mode, with this config

processes = 4

Running on a dual core cpu with hyperthreading enabled, does that mean I can have [close to] true parallelism of processing 4 requests at the same time?

Would it have significant performance advantage over a dual core cpu without hyperthreading enabled?

And how about this config on CPU with/without hyperthreading?

processes = 4
threads = 8
enabled-threads = true

Solution

  • Since you already use multiprocess uWSGI, enable-threads will not increase performance. It can only save you some RAM, so if you're not short on memory, you should stay away from threads because of GIL.

    As for hyper-threading, don't guess it, test it! Performance gain (or loss) totally depends on the app, so try different setups, including processes. It's unlikely that you get 2x gain from HT, but still it may be significant.