On 6/23/09 10:22 AM, Christian Boos wrote: > Shane Caraveo wrote: >> Hello, >> I've been looking into performance and profiling, and noticed the >> gc.collect that happens at the end of every request (in trac.web.main). >> On my osx dev box, this garbage collection is taking roughly 37% of >> the request time on a simple template, and removing it shows the roughly >> the same percent increase in requests/second (with ab). I haven't >> tested with more intensive templates (e.g. reports or timeline) where I >> assume it would take less percent, however this is pretty significant. >> >> Removing it unfortunately introduces some issues with the database pool >> and postgres (may be more related to how we're using the database). It >> also looks like, based on ticket 6614, that it will introduce a number >> of other issues if it is removed. I haven't fully digested 6614 yet, >> it's pretty lengthy. >> >> I'm just wondering if anyone has any comments or thoughts about this. >> > > It's been discussed not so long ago on Trac-Dev, see > http://groups.google.com/group/trac-dev/msg/9dcdaffccc74471c > As you can see there, I did some tests recently, but unfortunately not > on Linux, where the benefits of the explicit gc.collect() were the more > important, IIRC (not sure I ever digested #6614 either ;-) ). > > It would be nice to test again on Linux. Maybe other approaches are > possible, in order to lower the frequency of the collections. In all > cases, the lesson learnt was to not necessarily trust Python to do the > right thing if it's not told to do gc explicitly, in long running > programs. Maybe this has changed with 2.6, though.
Having dealt with gc issues with pyxpcom for several years now in long lived multithreaded apps, python needs to be handled carefully if you want it to auto-gc correctly, but it can be done and is often preferable. Our problems were even more exagerated by the possibility that a javascript or c++ component could potentially be holding onto python objects creating circular references. I'll dig back through the other thread and the bug. I'm also going to profile heavier templates to see what impact gc has on those. Shane --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" 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/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~---
