Mobile app version of vmapp.org
Login or Join
Dunderdale272

: Should I use mod_wsgi embedded mode if I have full control of Apache? I'm managing a bunch of sites and applications in a shared hosting, using Django via mod_wsgi. I had planned to use daemon

@Dunderdale272

Posted in: #Apache #Django #SharedHosting

I'm managing a bunch of sites and applications in a shared hosting, using Django via mod_wsgi. I had planned to use daemon mode from the beginning (to avoid restart problems), but ended up purchasing a plan that allows me to run a dedicated Apache instance. I kept using daemon mode for convenience, but I'm afraid it's consuming more server resources than it should (I have different projects for each site, each with its own process and process group), so I'm considering switching to embedded mode.

Would that be a sensible thing to do? I'd still be able to restart Apache anytime I need to, and I wouldn't need so many child processes and sockets (so I hope the resource usage would decrease). But I'm unsure whether or not doing so would make it more difficult to manage those sites (if I need to update one, I have to restart all) or maybe the applications won't be properly isolated from one another.

Are these problems really significant (or only a minor nuisance), are there other drawbacks I coudn't foresee? I'm looking for advice in any aspect of this setup - mainainability, performance, security etc. Tips for improving the current setup are also welcome (I know how to correctly configure a basic mod_wsgi setup, but I'm clueless about sensible values for threads, processes etc).

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Dunderdale272

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gail5422790

How many is a bunch of sites and how have you set up daemon mode?

Initial impression would be that if hosting multiple sites that you would be worse off using embedded mode because you can't individually control number of processes for each. Thus if a site only really needed a single mutithread processes, you balloon out memory usage by number of child process Apache will create for embedded mode. Multiply that out across all sites and you are likely going to be much worse off.

As a general rule I would only recommend using embedded mode if you have the one site and you very much insure that you setup Apache MPM settings up properly for that one site. The defaults in Apache are very wrong for Python web applications.

So, better to use daemon mode. One site per daemon process group and prefer single default process with minimum number of threads necessary.

Provide more information about you setup and can perhaps provide more information. Do realise though that resource usage is more to do with your specific web applications and generally not the server.

Suggest you also go watch:
lanyrd.com/2012/pycon/spcdg/

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme