On Aug 10, 1:40 am, [EMAIL PROTECTED] (anders) wrote: > On 2007-08-09 17:08:55 +0530, Srinivasan R wrote: > > > I need to run many TG applications. So, I think it would not be wise > > to run each application on a seperate port with apache acting as the > > proxy. That is the reason why I tried mod_python. > > In my experience, running them as standalone processes and proxying > works much better *especially* if there are a lot of TG > applications. I'm not sure why, but running with mod_python seems to > result in a bunch of huge, slow apache processes that take up much > more memory than the same apps running standalone. > > On one of our production servers, I currently have 14 TG apps running > (standalone) behind a lighttpd proxy and it's using 208MB of RAM total > (so including the system, lighttpd, supervisord, and postgres). We > originally had them deployed with mod_python and were running out of > memory on a 1GB system.
The reason mod_python takes up so much memory is that (until TG2 comes along, according to Mark's comments) each distinct TG site instance has to be run in a distinct Python sub interpreter else they will interfere with each other. This means that in each Apache process you will have 14 sub interpreters in your example. Each of these TG instances will have their own copies of all Python modules. Thus, each sub interpreter will take at least ~15MB+ in memory. So, 14*15 = ~200MB. Now multiple that by the number of Apache child processes the server is using and you will see that overall memory requirements become quite significant. This is why using mod_python, or 'embedded' mode of mod_wsgi is not a good idea when hosting a lot of sites. Instead, you are better off using 'daemon' mode of mod_wsgi or mod_fastcgi as each TG instance will run in a separate process and thus overall memory requirements would only be ~200MB. There are also other reasons for avoiding using multiple sub interpreters to host multiple applications anyway. Main one is that there are some third party extension modules for Python that aren't written properly so as to be used from secondary sub interpreters, or from multiple sub interpreters at the same time. Thus simply to avoid potential for problems, use a separate process, and in case of mod_wsgi 'daemon' mode, also force application to run in main sub interpreter. Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

