怎样测量一台WEB(Django)服务器的负载能力.
最近在学着用Django开发一个服务器, 如何去测量它的性能,用谷哥搜一圈对这些概念还是一头雾水,比如:
QPS(TPS):每秒钟request/事务 数量
并发数: 系统同时处理的request/事务数
响应时间: 一般取平均响应时间
对上面这些概念没有直观的理解.下面是我用AB工具比着测试了一下,下面这个URL的请求就是一个用户登录的请求,登录成功后会分别在postgresql 与redis 里插入一条记录.请行家给解释指教 一下,这个结果达到一个什标准 ,非常感谢:# ab -n 1000000 -c 20000 "http://192.168.25.109:8090/app/auth/?uuid=623cc896cb764ccf9ed207848fd29eb5&key=123456"
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.25.109 (be patient)
Completed 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
Completed 500000 requests
Completed 600000 requests
Completed 700000 requests
Completed 800000 requests
Completed 900000 requests
Completed 1000000 requests
Finished 1000000 requests
Server Software: nginx/1.9.15
Server Hostname: 192.168.25.109
Server Port: 8090
Document Path: /app/auth/?uuid=623cc896cb764ccf9ed207848fd29eb5&key=123456
Document Length: 537 bytes
Concurrency Level: 20000
Time taken for tests: 45.129 seconds
Complete requests: 1000000
Failed requests: 16948
(Connect: 0, Receive: 0, Length: 16948, Exceptions: 0)
Non-2xx responses: 983052
Total transferred: 704407228 bytes
HTML transferred: 530542812 bytes
Requests per second: 22158.68 [#/sec] (mean)
Time per request: 902.581 [ms] (mean)
Time per request: 0.045 [ms] (mean, across all concurrent requests)
Transfer rate: 15242.91 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 33 376 68.3 380 1341
Processing: 66 514 136.1 493 2082
Waiting: 55 387 139.2 358 1955
Total: 139 890 135.4 881 2287
Percentage of the requests served within a certain time (ms)
50% 881
66% 921
75% 948
80% 968
90% 1014
95% 1071
98% 1229
99% 1343
100% 2287 (longest request)
我的NGINX配置 :
worker_processes auto;
worker_rlimit_nofile 1048576;
events {
use epoll;
multi_accept on;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 10;
server {
listen 8090;
server_name 192.168.25.109;
location / {
include uwsgi_params;
uwsgi_pass unix:///tmp/uwsgi.sock;
}
}
uWSGI的配置 :
[uwsgi]
project = mqtt_auth
base = /home/www
chdir = %(base)/%(project)
module = %(project).wsgi:application
uid = nginx
gid = nginx
disable-logging = true
virtualenv = /home/www/virtualenv
master = true
processes = 20
max-requests = 65536
socket = /tmp/uwsgi.sock
chmod-socket = 664
daemonize=/home/www/log/uwsgi.log
vcauum = true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是我后面再次调优的结果,请行帮忙评价一下.谢谢
jmeter压力测试压一下就知道了
用测试负载的工具
根据服务器配置,先计算一下,会得出一个预估值