S
S
softshape2017-02-11 19:17:48
Django
softshape, 2017-02-11 19:17:48

How to debug Django and reduce CPU usage?

On our server, the load on the CPU suddenly increased from 20-30% to 60-70%. In the top, you can see that 2-3 uwsgi processes are loading the percent, through which Django is launched. But to understand from top which code loads the percentage, of course, it will not work.
What are the means to find the Django code responsible for the load?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Klimenko, 2017-02-11
@softshape

hmm, nginx logs (for sure it's worth it), enable logging of request processing time, look at which requests are the most, which requests are processed the most.
I recently switched from using uwsgi as a service in debian to supervisor, I ran into a problem that when the supervisor was restarted, the child processes that were processing requests at that moment did not die and each of the non-dead processes loaded the percent into the shelf, adding the die-on-term option to uwsgi config.

R
Roman Kitaev, 2017-02-11
@deliro

Temporarily put https://github.com/django-silk/silk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question