Answer the question
In order to leave comments, you need to log in
Which is better in uWSGI Python configuration: workers or threads?
What is preferred multiple independent processes:
or one process and multiple threads:<workers>4</workers>
<workers>1</workers>
<enable-threads />
<threads>4</threads>
<workers>4</workers>
<enable-threads />
<threads>2</threads>
Answer the question
In order to leave comments, you need to log in
At one time, they used the Siege test to check various possible configurations.
Here, one must take into account the peculiarity of python and, in particular, the GIL, so that tasks that require processor time cannot be paralleled using threads, even if there are several CPUs. On the other hand, for tasks that require I / O, threads give their growth, in addition, the thread consumes less memory than the entire process.
If your program does not rely on single threading, then it makes no sense to have a number of processes significantly larger than the number of CPUs/cores. It would be better to use a hybrid, the number of processes for the number of CPUs, the number of threads ... well, it depends more on how much memory. We usually have 5-25 threads on different projects.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question