How much traffic does each site receive? What sort of traffic do they receive? Are they short lived requests less than 500ms, or long lived requests that could last seconds?
What Apache MPM are you using (prefork/worker/event) and what are the Apache MPM settings for that MPM? For 150 sites I would suggest you are adding too much capacity for each. Even one process with 5 threads can handle a lot of concurrent requests if requests are short lived. If you are trying to support sites which all have long running requests for file uploads etc, you are asking for trouble. The request timeout is ridiculously large, which suggests you might be trying to handle long running file uploads, which as I said is a bad idea. Anyway, to get started I suggest you watch: https://www.youtube.com/watch?v=H6Q3l11fjU0 <https://www.youtube.com/watch?v=H6Q3l11fjU0> Then do the following to at least cut down on CPU and memory. 1. Outside of all VirtualHosts add: WSGIRestrictEmbedded On This will ensure that the Python interpreter isn't setup in Apache child worker processes where not needed if only using mod_wsgi daemon mode. 2. In each VirtualHost add: WSGIApplicationGroup %{GLOBAL} This ensures the Python application runs in the main interpreter context and not a sub interpreter. Various Python packages do not work properly in sub interpreters. Ensuring main interpreter context is used will also save a bit of memory as well since don't have the main interpreter context there doing nothing when using a sub interpreter. Graham > On 16 Jan 2022, at 7:42 pm, Johan De Taeye <[email protected]> wrote: > > > HI All, > > I have a multi-tenant apache server where each tenant has its own wsgi > application in its own virtual host. > The apache configuration for a tenant roughly looks like: > <VirtualHost *:443> > ServerName domain-tenant-1 <http://env1.frepple.com/> > WSGIDaemonProcess tenant1 user=www-data processes=4 threads=4 > inactivity-timeout=7200 request-timeout=3600 display-name=apache-tenant1 > WSGIProcessGroup tenant1 > WSGIScriptAlias / "/home/ubuntu/config/tenant1/wsgi.py" > </VirtualHost> > > I am noticing detoriating response times when the number of tenants increases > beyond a certain limit - say 150. Neither CPU, database and memory seem to > be bottleneck. > Are there any apache or mod_wsgi configurations/parameters that can be > tuned/optimized for this type of deployment? > > All feedback & insight is highly appreciated! > > Johan > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/modwsgi/577e778b-87a5-47dd-9dd3-c7a8d40fdf73n%40googlegroups.com > > <https://groups.google.com/d/msgid/modwsgi/577e778b-87a5-47dd-9dd3-c7a8d40fdf73n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/2308C0CD-AE76-4978-9DEB-9D6C2D680CA1%40gmail.com.
