[CentralOH] Profiling Django Apps?

Eric Floehr eric at intellovations.com
Thu Aug 25 20:29:32 CEST 2011


Nick,

If it isn't web-specific stuff that DDT or Yslow would catch, you can
try pdb (the Python debugger) which can be invoked within emacs, vi
(vimpdb), or your favorite IDE, or you can try profiling your methods
via the standard library cProfile module.  You could create a cProfile
middleware something like:

http://djangosnippets.org/snippets/727/

Cheers,
Eric


On Thu, Aug 25, 2011 at 2:25 PM, Nick Albright <nick.albright at gmail.com> wrote:
> Well, I've configured s3 boto storage for the default storage of django, and
> using imagekit to process all the diff versions of the photos. (All that is
> really being uploaded is photos), so dunno if stores it in the DB someplace?
> or makes calls?
> Though, checking the Log Messages section in Django Debug Toolbar, seems to
> show alot of boto calls,, so it could be external calls in real time.
> I'm gonna keep digging! Thanks!
>  -Nick
> On Thu, Aug 25, 2011 at 2:13 PM, Issac Kelly <issac.kelly at gmail.com> wrote:
>>
>> Are you making any external API requests during the request cycle? That
>> can definitely slow you down.
>>
>> It seems like your SQL stuff is probably alright.
>>
>> On Thu, Aug 25, 2011 at 2:10 PM, Nick Albright <nick.albright at gmail.com>
>> wrote:
>>>
>>> <G>  Heck, what'd I'd love is like a python profiler type output (Well, I
>>> think I'd love that, but I may rue that day ;)
>>> Initial look through, the resource usage
>>> (http://dpaste.com/602618/)  generally seems to be like .5 sec CPU time, and
>>> 2.5 sec elapsed time.  (2.5 secs for just raw/initial HTML is the obvious
>>> bottleneck)
>>> Then 12 SQL queries taking like .4 to .9 ms each
>>> And the html is < 1K lines.
>>> And this is before any JS gets processed by the browser.  Just the
>>> initial HTML page.
>>> I'm currently wildly guessing that it may be the boto library I'm using
>>> for the amazon S3?  But would love more solid info.
>>>  -Nick
>>> On Thu, Aug 25, 2011 at 1:48 PM, Issac Kelly <issac.kelly at gmail.com>
>>> wrote:
>>>>
>>>> What else do you want out of DDT? I've found that between the cache
>>>> panel, and the SQL panel, I've been able to find most of my problems, my
>>>> worst problems have been a result of not properly using select_related, or
>>>> iterating over big querysets.
>>>> If it's slow, but not showing up in DDT, it could be one of several
>>>> things:
>>>> * Really, Really big pages (>10k lines) the template engine seems to
>>>> crap out on some of this
>>>> * Bad/Really Big JS.
>>>>
>>>>
>>>> On Thu, Aug 25, 2011 at 1:42 PM, Nick Albright <nick.albright at gmail.com>
>>>> wrote:
>>>>>
>>>>> Hello Everybody!
>>>>> I was wondering if anyone had any experience with profiling django
>>>>> apps. Things seem to be taking longer than I'd like in my one app, and I'm
>>>>> trying to figure out where the bottleneck may be.  And was wondering if
>>>>> anyone has done this before?  (I'm using django-debug-toolbar, which doesn't
>>>>> give me enough info)
>>>>> Just curious!
>>>>>  -Nick
>>>>> _______________________________________________
>>>>> CentralOH mailing list
>>>>> CentralOH at python.org
>>>>> http://mail.python.org/mailman/listinfo/centraloh
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> CentralOH mailing list
>>>> CentralOH at python.org
>>>> http://mail.python.org/mailman/listinfo/centraloh
>>>>
>>>
>>>
>>> _______________________________________________
>>> CentralOH mailing list
>>> CentralOH at python.org
>>> http://mail.python.org/mailman/listinfo/centraloh
>>>
>>
>>
>> _______________________________________________
>> CentralOH mailing list
>> CentralOH at python.org
>> http://mail.python.org/mailman/listinfo/centraloh
>>
>
>
> _______________________________________________
> CentralOH mailing list
> CentralOH at python.org
> http://mail.python.org/mailman/listinfo/centraloh
>
>


More information about the CentralOH mailing list