内容简介:对一个 Django 站点做 ab 压力测试
今天想起来测测一个小 Django 站点的性能和压力,寻找一下看有没有内存泄漏,先介绍下服务器的信息,站点部署在 Google Cloud Platform,实例尺寸是微型(1 共享 vcpu, 0.6GB 内存),价格大致是($4.28/月 估算值),地区是 asia-east1-c,速度还是挺快,由于之前送的 300 刀还没用完,所以不用担心钱钱问题。
部署方式主要参照的这篇文章 《How To Set Up Django with Postgres, Nginx, and Gunicorn on CentOS 7》 ,大致内容如下:
- CentOS 7
- Python 3.6.1
- Nginx 1.10.2
- Gunicorn 19.7.1
- Virtualenv 15.1.0
- Django 1.11.1
测试命令:
ab -c 5 -n 1000 http://www.cocoaz.com/
结果:
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.cocoaz.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.10.2
Server Hostname: www.cocoaz.com
Server Port: 80
Document Path: /
Document Length: 15823 bytes
Concurrency Level: 5
Time taken for tests: 277.324 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 16049000 bytes
HTML transferred: 15823000 bytes
Requests per second: 3.61 [#/sec] (mean)
Time per request: 1386.619 [ms] (mean)
Time per request: 277.324 [ms] (mean, across all concurrent requests)
Transfer rate: 56.51 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 21 208 425.4 24 3162
Processing: 100 1170 1442.9 801 20850
Waiting: 76 702 661.3 488 4786
Total: 124 1378 1561.5 1034 20883
Percentage of the requests served within a certain time (ms)
50% 1034
66% 1501
75% 1807
80% 2000
90% 3014
95% 3816
98% 5270
99% 6200
100% 20883 (longest request)
StackDriver 监控状态:
通过监控能看到 CPU 使用率最高飙到了 90%,内存一直稳定在 50% 左右倒是没怎么变化,所有请求都成功返回。
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 没有压力的“压力测试”:LSTM神经网络是如何预测焦虑的?
- [原]压力测试
- jmeter 分布式压力测试
- [站点记录] 在站点上启用 Let's Encrypt 通配符证书
- 使用ab压力命令测试网站性能
- 漫谈数据治理(一):计算与存储压力
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Wikis For Dummies
Dan Woods、Peter Thoeny / For Dummies / 2007-7-23 / USD 24.99
Corporations have finally realized the value of collaboration tools for knowledge sharing and Wiki is the open source technology for creating collaborative Web sites, as either a public site on the In......一起来看看 《Wikis For Dummies》 这本书的介绍吧!