On Sun, May 24, 2009 at 7:22 AM, Antoine Pitrou
<[email protected]> wrote:
>
> Hello,
>
> Launch a Python interactive session. Don't do anything special, just
> launch it. Look at the memory usage of this process (e.g. `ps aux |
> grep python`). The process takes about 4 MB.
>
> Then, just type :
>>>> import tg
>
> Just that. Nothing else. No application modules or data. Look at the
> process size again. Here it is 28 MB /just for having imported
> TurboGears/. (your mileage may vary)
>
> This shows some of the problems associated with the TurboGears
> approach of "re-use every third-party module under the sun". If you
> suddenly find out that your mod_wsgi daemon process bubbles to 300MB+
> values, no, there isn't necessarily a memory leak in your Web
> application. You are just using TurboGears :-)
>
This is also a misinterpretation, it fact it almost falls into the FUD
argument. At runtime X lines of code are X lines of code it doesn't
maters from where they come from.

Just for comparison, I know from a very good source than Django
running under mod_python in a WebFaction server will take 20-30MB of
RAM, per process (with 3 workers). go ahead and try your same
experiment with that package.

Now here is the fun fact. I'm sure TG+ all it's dependencies is many
more LOC than django, someone should count those. Which simply means
that your argument is completely reversed and using third-party
dependencies is actually better as their memory footprint is smaller.

> If your mod_wsgi setup has instantiated 8 worker threads,

That is a ton of wasted RAM, you should be able to reduce our workers
and increase their maxrequests and get the same results with much
better ran.

> Regards
>
> Antoine.
>
>
> PS : those numbers are taken on a 64-bit setup. A 32-bit build of
> Python would show significantly smaller numbers, due to the smaller
> pointer (and C long) size.
>
> PPS : the cost of a single garbage collection then becomes quite funny
> to watch, too:
> - before tg is imported:
> python -m timeit -s "import gc" "gc.collect()"
> 100 loops, best of 3: 3.05 msec per loop
> - after tg is imported:
> python -m timeit -s "import tg, gc" "gc.collect()"
> 10 loops, best of 3: 61.5 msec per loop
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to