Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django development server CPU intensive - how to analyse?

Tags:

python

django

cpu

I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this?

Thanks!

Martin

like image 598
Hoff Avatar asked Nov 17 '09 18:11

Hoff


3 Answers

FWIW, you should do the profiling, but when you do I'll bet you find that the answer is "polling for changes to your files so it can auto-reload." You might do a quick test with "python manage.py runserver --noreload" and see how that affects the CPU usage.

like image 165
Carl Meyer Avatar answered Nov 09 '22 19:11

Carl Meyer


Hit Control-C and crash the process. It will probably crash somewhere that it's spending a lot of time.

Or you could use a profiler.

like image 33
wisty Avatar answered Nov 09 '22 19:11

wisty


http://docs.python.org/library/profile.html

That's the standard approach.

like image 3
S.Lott Avatar answered Nov 09 '22 18:11

S.Lott