I am quite new to the combination of apache and django and quite naive frankly regarding to how multi-threading is handeled. Specifically I run on a windows server, so I know the MPM is only thread-based.
I have an application which serves a website's pages, and another application which performs a cpu intensive background process which happens from time to time and takes as much as 30 seconds or so. I am worried that I might run into performance issues and have several questions, I hope these will help others as well...
- How does apache distribute concurrent requests between threads? and between CPUs? What kind of logic drives this? Does each request spawn a separate thread?
- Can I manually specify a certain app to be run on a separate CPU? For example, if I have a machine with 4 CPUs, can I set 1 CPU for website requests and 3 other for running the background process on demand?
- How do multiple threads read/write to same database? I don't expect to have collisions since writing will be carried out per-user, but I don't know how this is actually handeled.
- What happens if I have more than one such machine, for example running on EC2 and having more than one instance? How are requests distributed?
Thank you