I have got an easy wsgi application running with Apache prefork MPM and i have been reading through the modwsgi docs on processes and threads (great read). I am still unclear about a few things and an amount need synchronization.
/1 If my Apache config is just a simple WSGIScriptAlias to my wsgi application such as this:
WSGIScriptAlias /alias_name /path/to/wsgi/app.wsgi
and presuming prefork MPM Apache build, then your wsgi thread and process flags are available in such as this [wsgi.multiprocess = True, wsgi.multithread = False]. I realize what this means is just one process (no threads) is handling each request. As well as on these terms I would not have to synchronize anything because I am not doing any IPC between your processes and every process features its own address space. Is the fact that correct thinking?
/2 If my Apache config used WSGIDaemonPrcoesses however:
WSGIScriptAlias /alias_name /path/to/wsgi/app.wsgi WSGIDaemonProcess wsgi_proc_names processes=2 threads=2 WSGIProcessGroup wsgi_proc_names
then your wsgi flags are available in as [wsgi.multiprocess = true, wsgi.multithread = true] and there's an opportunity the threads might board each other peoples toes. Here's where I should synchronize use of certain data. If my application doesn't have I/O then what else would want synchronization? For instance, do class variables have to be locked on editing? Would functions which are being known as by multiple threads have to be locked and launched? This is exactly what I'm most unclear about.