I have a server with too many virtual hosts, about 500 virtual hosts, half of this with SSL.
All this hosts are served with mod_wsgi for Django applications.
I notice that after a certain number of virtual hosts all my server stops to work and all the sites crashes, I can handle this lowering the number of threads for each virtual hosts with this line:
WSGIDaemonProcess my.domain python-home=/var/www/env python-path=/var/www/my_app threads=1
The apache is crashing when reach about 1300 threads (when I check in htop). The error log of apache indicates that the module Django is no found, but this is not the real error, because everything is OK e just happens when the number of vhosts is too high. So I think I'm reaching some kind of limit with process or threads in Linux. I'm using Ubuntu 18.04, Apache 2.4, and have enough RAM and CPU, the server has 4 GB of RAM and is using just 2 GB, the average CPU is 10 to 20%.
I yet check my threads-max limit with:
cat /proc/sys/kernel/threads-max
30893
What can I do to increase the capacity of virtualhosts in my apache without creating another server.