performance - Django request impossibly slow, can't find why -


I have an Apache 2 + mod_python setup that responds slower to impossible for a few days Two seconds, the processor time for some of my app's requests for some interesting points:

  • Debugers say that this is the question time of 15ms. DB is not the main suspect
  • Logging with datetime.now () shows that 0.1s are spent inside the SV, and 40ms more requestor is spent inside the text
  • I could not find any easy way rendering template for time.

Where can I see?

Suppose there was infinite loop in it. How do you get it?

I think you'll stop it in debugger and see the code at different levels of the stack because you know that the loop is somewhere on the stack. Okay?

Assume that the loop is not infinite, taking only a long time is it very different?

No problem, what's the problem, if you take some time like 90% or 50% or 20%, then it's likely that you'll catch it in when you stop it So if you stop it several times, then you are going to see it worse than that, it will be clear that for a short time you have to stop and see it.

So forget about the time.


In response to the question, here is some mod_python document:

5.4.1 Python Enables PDB Syntax:
Python Enables PDB {ON, OFF}
Default: PythonEnablePdb Closed: Context: Server Config, Virtual Host, Directory, HTCover Override: No None Module: mod python.c When, on the Python debugger using the modern python pdb.runcall () function pdb The handler function will execute within Because pdb is an interactive tool because when using httpd command, start httpd from the command line with the on-process option. As soon as your handler code is entered, you will see a PDB prompt, so that you have to check the step and variable through the code.

5.4.2 Python Debug Syntax:
Python Debug {ON, OFF} Default: Python Debug Closing Context: Server Config, Virtual Host, Directory, HTACRR Override: None None Modules: mod python Generally, traceback output generated from unsafe python errors is sent to the error log. On the specified instruction with PythonDebug, the output client (as well as the log) will be sent, except that when writing the error IOError, in that case this error will be logged on. This instruction is very useful during the development process. That you do not use it in the production environment because it may reveal potentially sensitive security information about the client.


Comments