mod_wsgi in embeded mode allows graceful restart, What are the potential issues that I will face if I use mod_wsgi in embedded mode instead of daemon mode, I have to host around 260 python micro services.
I have saw your blog on 'why are you using mod_wsgi in embedded mode?' But, I unable to understand it very well in that you mentioned if we configure mpm settings correctly then mod_wsgi in embedded mode is better than daemon mode but not mentioned any configurations. Thanking you, RajKumar On Tuesday 23 July 2024 at 13:04:50 UTC+5:30 Graham Dumpleton wrote: > On 23 Jul 2024, at 4:09 PM, RajKumar Ambadipelli <arkki...@gmail.com> > wrote: > > I am using Apache Server with mod_wsgi for hosting my python django > applications. Versions: Python 3.9.18 Server version: Apache/2.4.57 > mod-wsgi==4.7.1 > > One of my application virtual host configuration with two different > versions: > > ... > > So, When the source code is modified I can referesh the wsgi daemon using > touch /home/uoadmin/releases/1.1.0/students/conf/wsgi.py touch > /home/uoadmin/releases/1.0.0/students/conf/wsgi.py But when I added new > virtualhost to the above configuration file or else when I modify above > file the apache server unable to recognize modifications made the existing > virtualhost or newly added virtualhost until doing apachectl graceful (or) > apachectl restart (or) systemctl reload httpd but all the commands above > killing the ongoing requests forcefully directly terminating them. > > How to handle above situation. > > I want to know how will apache server recognize modifications to > virtualhost or newly added virtual host without reloading or restarting. > > It can't, Apache httpd requires you to perform a restart (reload) in order > to read changes to the Apache configuration files. That is how it works. > > If above is not possible then is there anyway for restarting or reloading > apache server gracefully that is without terminating or killing other > ongoing requests or daemons while using apache server + mod_wsgi for > serving python with django? > > Unfortunately not. The way Apache httpd manages the mod_wsgi daemon > processes it will force a restart of those as well and even though Apache > has a concept of graceful restart for it's own worker child processes, it > doesn't extend that to managed process like the mod_wsgi daemon process and > always restarts them immediately even when it is a graceful restart. There > is nothing that can be done about this. > > The only way you could handle it if you need to be able to freely restart > the main Apache server and have it not affect your Python web applications, > is to run the Python web applications in distinct secondary web server > processes and use the main Apache server to only proxy requests through to > the secondary web servers. > > For the second web servers you could use mod_wsgi-express to make things > easier, but you could also just not use mod_wsgi for the secondary web > servers and use gunicorn or some other standalone Python WSGI/asyncio web > server. > > Graham > > > -- 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 modwsgi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/d28663bc-a143-4e4f-949d-38e065c5ac9fn%40googlegroups.com.