Graham Dumpleton wrote: > On Jul 24, 6:28 pm, Gábor Farkas <[EMAIL PROTECTED]> wrote: >> hi, >> >> how does it work exactly, when i have multiple django sites running in >> one apache server using mod_python? >> >> for example, imagine that i have 10 django sites running in one apache >> server. >> >> does that mean, that in every apache process, i have 10 python >> interpreters loaded? > > Yes. > >> or in other words, if i have 10 django sites in one apache, does it use >> 10times more memory than when running only one django site? > > More or less, yes. > > If you tested that your code on top of Django and any third party > modules you use is multithread safe then you can limit the overal > memory used across all processes by using the 'worker' MPM for Apache > rather than the 'prefork' MPM. This helps because with 'worker' you > run with a lot less Apache child processes than with 'prefork'. The > number of Apache child processes can still spike up with 'worker' MPM > when there is the demand, but as demand drops off, Apache will kill > off excess processes. Even so, that each instance occupies memory in > each process still means a lot of memory overall. > > If you need more control than that then you would need to explore > other options such as daemon mode of mod_wsgi or mod_fastcgi, which > both provide the ability to run each Django instance in a defined > number of distinct daemon processes. In the extreme case, you could > run Django on top of a Python WSGI server and run it in just a single > process behind Apache by proxying requests to it. > > Memory use of running multiple Django instances under Apache using > mod_python is only one of the problems that can arise in this > instance. Other problems are the ability for the Django instances to > interfere with each other due to C extension modules which haven't > been written properly to be used from multiple sub interpreters at the > same time, or even attempts to use different versions of a C extension > module from the different Django instances. Using mod_wsgi or > mod_fastcgi may therefore be a better solution given they allow > separation of the Django instances. > > So, the question is, what are you trying to achieve or want? Was there > a specific reason for the question? Knowing what you are really trying > to do, might be able to suggest others things you can read to learn > how Apache manages processes and how Python sub interpreters are used > in this scenario.
thanks for the information. for various reasons, some of our django applications are running using apache+fastcgi, and some using apache+mod_python. we were preferring mod_python (because it's the "recommended" setup for django), and only used the fastcgi-solution where we could not use mod_python (again, various stupid reasons :) but now we will probably have to add more django applications to the system, so i was thinking if it should be done using mod_python or fastcgi (i am sorry but i did not consider mod_wsgi, because i had the feeling that it's still "too new". btw. would you consider it production-ready? (i understand that it's a stupid question :)) so from what i've read here, it seems fastcgi/mod_wsgi-daemon-mode would be the safest route (i've read the discussion about psycopg2+decimal on django-devel). btw. what do you think about having multiple apache-servers with mod_python, each hosting only one django-application. would that be an overkill? p.s: the django-applications i am talking about are intranet-apps, so we do not think there will be much load on them... thanks, gabor --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

