简体   繁体   中英

Profiling on live Django server?

I've never done code coverage in Python, but I'm looking for something like GCC 's gcov , which tells me how many times each line executes, or Apple's Shark which gives a hierarchial breakdown of how long each function is taking.

My problem is that I have a live server which is experiencing high load, and I can't tell from the logs what's causing it. I would like to attach something to my Django instance to monitor which lines are the hottest and/or which functions are taking the longest time.

This is something like, but not exactly, code coverage. I would like to introduce it to a live running server, preferably without modifying too much.

Ideas?

Django-live-profiler是一个插入式Django应用程序,它允许您使用statprof配置正在运行的应用程序并可视化结果。

cProfile + RunSnakeRun: http ://www.vrplumber.com/programming/runsnakerun/

I use this pattern: A monitor threads writes stacktraces to a log file every 0.3 seconds. After some hours I can see where the interpreter spends the most time. It does not slow down the my server:

Live Profiling of Python Server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM