[BangPypers] log and figure out what bits are slow and optimize them.

steve steve at lonetwin.net
Tue Feb 14 10:00:16 CET 2012


Hi,

If it's a production website you might want to look at NewRelic. We started
using it a while back and it has been mighty helpful:

http://newrelic.com
http://newrelic.com/docs/python/new-relic-for-python

cheers,
- steve

On 02/12/2012 08:09 PM, Anand Chitipothu wrote:
> 2012/2/12 Saju M <sajuptpm at gmail.com>:
>> Hi,
>> I wrote a decorator using cProfile.
>> Issue is log-file getting messed up with logs of unwanted method
>> calls(library calls).
>> I tried with prof.getstats() and prof.print_stats(), prof.getstats() force
>> to code extra loops to get infos.
>> I am also planning to enable/disable this logging using DEBUG flag.
>>
>> Have any suggestions to improve this code ???  or  any other-way ??
> 
> Since you are doing this in a webapp, you should be able to write a
> WSGI middleware that enables the profiler if profile=true is passed as
> query parameter.
> 
> I found this technique very useful to optimize webapps. Here is an example:
> 
> http://openlibrary.org/books/OL1M/Kabit%C4%81.?_profile=true
> 
> web.py has a nice profile middleware, it shouldn't be too hard to reuse it.
> 
> https://github.com/webpy/webpy/blob/master/web/http.py#L140
> https://github.com/webpy/webpy/blob/master/web/utils.py#L1070
> 
> Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers


-- 
random spiel: http://lonetwin.net/
what i'm stumbling into: http://lonetwin.stumbleupon.com/


More information about the BangPypers mailing list