Производительность параллелизма в Django (apache2 prefork/mod_wsgi), что я делаю неправильно?

Да, Это делает. Используйте **kwargs в функциональном определении.

Пример:

def f(**kwargs):
    print kwargs.keys()


f(a=2, b="b")     # -> ['a', 'b']
f(**{'d'+'e': 1}) # -> ['de']

, Но почему Вам нужно это?

6
задан schmilblick 26 September 2009 в 07:18
поделиться

1 ответ

As you are using prefork MPM and mod_wsgi in embedded mode with lots of processes, you are possibly killing the performance of your box. For a start, suggest you read:

http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html

Using embedded mode like you are, you need to tune your MPM parameters carefully. Setting MaxRequestsPerChild to be non zero is not a good start as you are going to periodically force out the Apache processes, with the result that you will cause a load spike as everything has to reload.

Would suggest worker MPM and with your Python web application running in mod_wsgi daemon mode. This for a start will result in a lot less processes being run, less memory overhead, and give more predictability around the performance of the system. Can then start to look more closely at why things may be running slower.

One thing to pay attention to is what you get for the following section of 'ab' output:

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     0    0   0.2      0       2
Waiting:        0    0   0.1      0       2
Total:          0    0   0.2      0       2

If the max column shows large values, then you are getting hit by the application loading costs due to your either not eliminating them from your tests through preloading, or by short process restart interval.

12
ответ дан 9 December 2019 в 20:46
поделиться
Другие вопросы по тегам:

Похожие вопросы: