Search code examples
mod-wsgipyenv

mod_wsgi shared library is over 1MB using pyenv


I work on an AWS lightsail server with a LAMP self-contained installation stack and I want to host a second web-app in django. Tried to install mod_wsgi to a pyenv virtual environment (3.8.3 or 3.8-dev, both with shared libraries installed) using

export APXS=/opt/USER/apache2/bin/apxs

pip install mod_wsgi                (tried with and w/o wheel)

but the module mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so that created is over 1MB in size.

-rwxrwxr-x 1 USER USER 1157792 Jun 21 20:15 mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so

ldd gives:

ldd mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so 
    linux-vdso.so.1 =>  (0x00007ffc3e198000)
    libpython3.8.so.1.0 => /home/USER/.pyenv/versions/3.8-dev/lib/libpython3.8.so.1.0 (0x00007fce67120000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fce66f03000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fce66b39000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fce66935000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fce66732000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fce66429000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fce678f0000)

According to the manual https://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#lack-of-python-shared-library, that should be a problem for my server's memory performance.

Is there something else that I could do in order to get a ~250KB in size module as the docs describe it?


Solution

  • mod_wsgi.so size of 1.1MB is fine nowadays.

    Newbie questions regarding installation and python shared library