Mod_wsgi (3.4-14) / Apache 2.4.12 / Red Hat (6.7) / Django 1.8.2 suspended under load

I have a problem with mod_wsgi (3.4-14) / Apache 2.4.12 / cx_oracle 5.2 / Oracle 12 / Django 1.8.2, freezing under heavy load. The configuration has been used over the past few months in dev / testing.

Now when deployed to a production environment, Apache hangs in a couple of minutes at a higher load (it works fine with a small or moderate load).

I have a cluster of 3 Django / Apache / mod_wsgi servers, and when this happens, each server stops responding (one after the other) for 5-15 minutes.

Here is my configuration

I am using Python 3.3 and Apache 2.4.12 and mod_wsgi-3.4-14 from Red Hat (6.7) Software Collection

Apache virtual host ... WSGIDaemonProcess app.prod processes = 2 threads = 25 display- name =% {GROUP} user = MY_USER python-path = MY_PATH WSGIProcessGroup app.prod WSGIScriptAlias โ€‹โ€‹// opt / hosts / app / app / wsgi .py

Apache version
Server version: Apache/2.4.12 (Red Hat)
Server built:   Aug 11 2015 08:12:59
Server Module Magic Number: 20120211:41
Server loaded:  APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     worker
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/opt/rh/httpd24/root/etc/httpd"
 -D SUEXEC_BIN="/opt/rh/httpd24/root/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/opt/rh/httpd24/root/var/run/httpd/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

python33-mod_wsgi-3.4-14.el6.x86_64

Django db configuration
'default': {
    'ENGINE': 'django.db.backends.oracle',
    'NAME': 'DB_NAME',
    'USER': 'webuser',
    'PASSWORD': 'webpassword',
    'HOST': '',
    'PORT': '',
    'CONN_MAX_AGE': None,
    'OPTIONS': {
        'threaded': True,
    },
},


#0  0x00007f047ff099b0 in sem_wait () from /lib64/libpthread.so.0
#1  0x00007f0474b4c6d8 in PyThread_acquire_lock_timed () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#2  0x00007f0474b2cab5 in _PyImport_AcquireLock () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#3  0x00007f0474b2cf49 in PyImport_ImportModuleLevelObject () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#4  0x00007f0474b10f8f in ?? () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#5  0x00007f0474b1baa4 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#6  0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#7  0x00007f0474b1c457 in PyEval_EvalCodeEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#8  0x00007f0474b1aead in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#9  0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#10 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#11 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#12 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#13 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#14 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#15 0x00007f0474b1c457 in PyEval_EvalCodeEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#16 0x00007f0474a90842 in ?? () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#17 0x00007f0474a69fd6 in PyObject_Call () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#18 0x00007f0474b11763 in PyEval_CallObjectWithKeywords () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
#19 0x00007f0474e8f6ac in ?? () from /opt/rh/httpd24/root/etc/httpd/modules/mod_python33-wsgi.so
#20 0x00007f0474e93f8b in ?? () from /opt/rh/httpd24/root/etc/httpd/modules/mod_python33-wsgi.so
#21 0x00007f0474e976c8 in ?? () from /opt/rh/httpd24/root/etc/httpd/modules/mod_python33-wsgi.so
#22 0x00007f047ff03a51 in start_thread () from /lib64/libpthread.so.0
#23 0x00007f047fc509ad in clone () from /lib64/libc.so.6

If I reduce the number of mod_wsgi, the problem will disappear, but performance is not acceptable.

WSGIDaemonProcess app.prod processes=4 threads=1 display-name=%{GROUP} user=MY_USER python-path=MY_PATH

Can someone say what could be the reason or how can I debug it, please?

More on the mod_wsgi Newsletter

+4
source share
2 answers

, . django , apache . , , . , : free -m. 100-200mb , apache .

0

mod_wsgi

= 12 = 1 -timeout = 300 = 1000

.

.

0

Source: https://habr.com/ru/post/1609360/


All Articles