Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling a long-running Python Server

I have a long-running twisted server.

In a large system test, at one particular point several minutes into the test, when some clients enter a particular state and a particular outside event happens, then this server takes several minutes of 100% CPU and does its work very slowly. I'd like to know what it is doing.

How do you get a profile for a particular span of time in a long-running server?

I could easily send the server start and stop messages via HTTP if there was a way to enable or inject the profiler at runtime?

Given the choice, I'd like stack-based/call-graph profiling but even leaf sampling might give insight.

like image 426
Will Avatar asked Mar 22 '12 09:03

Will


1 Answers

yappi profiler can be started and stopped at runtime.

like image 139
Mikhail Korobov Avatar answered Sep 28 '22 03:09

Mikhail Korobov