[英]Python Django Profiling
Problem: 问题:
I have a Django application. 我有一个Django应用程序。 At the development stage I want to check 在开发阶段我要检查
The number of users my app can support. 我的应用程序可以支持的用户数 。 These users can be : 这些用户可以是 :
Find speed improvements, for example chunks of slow code 查找速度改进,例如,慢速代码块
Tools Used: 使用的工具:
I have installed django-debug-toolbar, which shows the Time (CPU) and SQL queries . 我已经安装了django-debug-toolbar,它显示了时间(CPU)和SQL查询 。
What I want: 我想要的是:
I specifically want particular graphs or contitative data which can be presented to a large scale audience and on which improvements can be done. 我特别希望可以将特定的图表或有争议的数据呈现给广大受众,并在此基础上进行改进。
I don't think there's an app for that matter. 我认为没有针对此问题的应用程序。
You can use apache ab
to measure how many requests your app can handle on a givel URL. 您可以使用apache ab
来衡量您的应用程序可以在木槌URL上处理多少个请求。
ab -c 5 -n 1000 http://yoururlhere.com
See the ab docs for more. 有关更多信息,请参见Ab文档 。
Your "users stored in the database" are limited by your servers hard disk space available, so this should not be a problem. 您的“存储在数据库中的用户”是由您的服务器的可用硬盘空间的限制,所以这不应该是一个问题。
To find slow code the django toolbar is a good start. 要查找慢速代码,django工具栏是一个好的开始。 If you finde a site that takes long time to load, you can investigate which methods causing this by manually adding: 如果找到加载时间很长的网站,则可以通过手动添加以下内容来调查导致此问题的方法:
import logging
def my_slow_code(self):
start = time.time()
[slow code]
logging.debug('my_slow_code took %s s to load' % str(time.time()-start))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.