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. Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---