Testing multithreaded behavior
In the previous section, we encountered a few environmental differences between running under the development server and running under Apache. Some of these (for example, file permissions and Python path differences) caused problems that had to be overcome before we could get the project functioning properly under Apache. One difference we observed, but have not yet encountered a problem with, is multithreading.
When we checked the error log in the previous section we could see that mod_wsgi
had started one process with 15 threads, each ready to handle an incoming request. Multiple requests that arrive at the server nearly simultaneously, then, will be dispatched to different threads for handling, and the steps of their execution may be arbitrarily interleaved in real time. This can never happen with the development server, which is strictly single threaded, ensuring each request is fully processed before processing of the next one is started. It also never...