测开之路七十二:性能测试工具之locust简介
2024-09-27 01:05:05
locust官网:https://locust.io/
locust安装(不支持python3.7):pip install locustio 或者pycharm安装
官网给出的样例
根据官网代码新建一个脚本
from locust import HttpLocust, TaskSet, task class WebsiteTasks(TaskSet): @task(weight=2) # weight:发压的比例,可以不设置
def index(self):
self.client.get("/guonei") # 百度新闻的国内:http://news.baidu.com/guonei @task(weight=8)
def about(self):
self.client.get("/guoji") # 百度新闻的国际:http://news.baidu.com/guoji class WebsiteUser(HttpLocust):
task_set = WebsiteTasks
min_wait = 1000 # 最小等待时间,毫秒
max_wait = 3000 # 最大等待时间,毫秒
执行:locust -f 脚本 --host=要压的host:locust -f locustfile.py --host=http://news.baidu.com
访问localhost:8089(不能用127.0.0.1)
Statistics页面:
Charts页面
Failures
Exceptions
Download Data
Ctrl + C结束也会在窗口生成数据
最新文章
- sql跨数据库转移
- 如何在WPF中引用Windows.System.Forms.Integration
- Learn python the hard way. python test program 2016.04.27
- 着色器(Shader)
- TCP/IP, HTTP, socket
- Codeforces Round #316 (Div. 2)
- xcode5下面安装Command Line Tools
- net 2.0使用ajax
- ASP.NET MVC IOC之Unity攻略
- 使用axis2访问webservice(webserivice基于.net平台实现)
- C#基础知识-函数的定义和调用(五)
- 转载 远程用户连接mysql授权
- Java VisualVM无法检测到本地java程序 的 解决办法
- centOS7下Spark安装配置
- 【代码审计】YzmCMS_PHP_v3.6 任意文件删除漏洞分析
- php中parse_url函数解析
- 分析器错误消息: 未能找到 CodeDom 提供程序类型
- Linux下找不到动态链接库(转)
- tera term通过ttl脚本 自动连接服务器(转自http://www.cnblogs.com/wxb0328/p/teraterm.html)
- unity, Root Motion