Am Freitag 03 September 2010, 12:05:47 schrieb Graham Dumpleton:
> On Sep 3, 7:45 pm, Dirk Eschler <esch...@gmail.com> wrote:
> > Hello,
> > 
> > i experience slow page loads in production using mod_wsgi. The django
> > debugging toolbar reveals a very high CPU use with lots of voluntary
> > context switches:
> > 
> > Production (Apache mod_wsgi-3.2, daemon mode, 10 threads):
> > User CPU time    3580.224 msec
> > System CPU time  156.010 msec
> > Total CPU time   3736.234 msec
> > Elapsed time     3671.237 msec
> > Context switches 21573 voluntary, 108 involuntary
> > 
> > Same page compared using the dev server:
> > 
> > Development (Django dev server):
> > User CPU time    90.987 msec
> > System CPU time  5.999 msec
> > Total CPU time   96.986 msec
> > Elapsed time     99.323 msec
> > Context switches 0 voluntary, 51 involuntary
> > 
> > SQL queries doesn't seem to be the problem. I reduced the number of
> > queries to 1 or 2 using johnny-cache, but the CPU time is still nearly
> > the same as in the above example.
> > 
> > The load of the server is somewhere around 0.1 to 0.3 so this can't be
> > the problem either.
> 
> Is this on an initial request to the application or all requests?

This is on all requests. If the page is reloaded several times, chances are 
good that i hit one with 0 voluntary context switches, but the CPU time is 
still about the same, always around 3500ms .

> Is this only for a specific URL of your application or all URLs?

All, but only the frontend ones, the admin is fast. So the problem must be 
related to something that is only used in the frontend in production.

> What is the actual mod_wsgi configuration snippet from Apache
> configuration file?

WSGIDaemonProcess foo user=foo threads=10
WSGIProcessGroup foo
WSGIScriptAlias / /path/to/django.wsgi

> Have you confirmed in some way that your application is in fact
> running in daemon mode?

'ps' shows apache processes with the user used in my config and 'touch 
django.wsgi' reloads the application.

> What Apache MPM are you using?

mpm-prefork

> What is MaxRequestPerChild set to in your Apache configuration?

It was set to 0. Changed it to 500 now, but doesn't seem to make any 
difference.

p.s.:
Okay i found it. It is related to the django_compressor app which is used in 
production but not on the development server. When disabled, the CPU time is 
back to normal!

Thanks for your help,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to