当前位置:网站首页>Locust performance test - environment construction and use
Locust performance test - environment construction and use
2022-07-04 22:31:00 【Peng Yuyan in the testing industry】
1. What is? Locust?
Locust Is an easy to use , Scriptable and extensible performance testing tool . You can use the general Python Code defines user behavior , This makes Locust It can be expanded infinitely , And very friendly to developers .
2. features
Distributed and scalable - Support hundreds of thousands of users
Locust Make it easy to run load tests on multiple computers . It's event based ( Use gevent), This allows a single process to handle thousands of concurrent users . Although there may be other tools that can perform more requests per second on a given hardware , But every one of them Locust The user's low overhead makes it ideal for testing high concurrency workloads .
be based on Web Of UI
Locust Have user-friendly Web Interface , It can display the test progress in real time . You can even change the load while the test runs . It can also be in the absence of UI Operation in case of , So that it can be easily used for CI / CD test .
Can test any system
Even if Locust Main content and website / Services are used together , It can also be used to test almost any system or protocol . just Write a client for what you want to test , Or browse some clients created by the community .
3. Environmental installation
Official documents
https://docs.locust.io/en/1.4.4/what-is-locust.html
install Python 3.6 Or later .
Use pip installLocust.pip install locust
Verify the installation and display locust Version numberpip show locust(venv) E:\workspace\LocustConcurrent>pip show locustName: locustVersion: 1.4.4Summary: Developer friendly load testing frameworkHome-page: https://locust.io/
4. Quick start
stay Locust in , You can use Python Code defines user behavior . then , You can use the locust Command and ( Optional ) Its Web The interface generates and simulates a large number of these users as it collects request statistics .
locust_cnblogs.py
''''Create by dell on 2021/4/13Author :wenchengdescribe :'''from locust import HttpUser, task, betweenclass QuickstartUser(HttpUser):wait_time = between(1, 2.5)@taskdef bky_deom(self):self.client.get("/")@task(3)def bky_demo2(self):self.client.get("/wen-cheng")if __name__ == '__main__':import osos.system('locust -f locust_cnblogs.py -H https://www.cnblogs.com')
5. Startup and operation locust

open locust Of web Interface , Browser access :http://127.0.0.1:8089
Set the number of virtual users 20, Start every second 5 Users , Click on Start swarming Began to run

locust Of web Interface analysis :
Number of users to simulate It's the number of simulated users
Hatch rate (users spawned/second Represents the speed at which simulated users are generated
Start swarming Start testing
6. Analyze test results

Type: Request type ;
Name: Request path ;
Requests: Number of current requests ;
Fails: Number of current request failures ;
Median: In the middle , Unit millisecond , Generally, the server response time is lower than this value , The other half is higher than that ;
Average: Average response time for all requests , millisecond ;
Min: Minimum server response time for requests , millisecond ;
Max: Maximum server response time for a request , millisecond ;
Content Size: The size of a single request , Unit byte ;
Reqs/sec: Number of requests per second .
Interface chart display


throughput / Number of response transactions per second (rps) Real time statistics Mean response time / Real time statistics of average transactions Number of virtual users running
Derived data

The above is the whole content of this article , I hope the content of this article has a certain reference value for your study or work , If you have any questions, you can leave a message , Thank you for your support .
Learning resource sharing
Finally, thank everyone who reads my article carefully , Watching the rise and attention of fans all the way , Reciprocity is always necessary , Although it's not very valuable , If you can use it, you can take it

These materials , For thinking 【 Advanced automated testing 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! Everything should be done as soon as possible , Especially in the technology industry , We must improve our technical skills . I hope that's helpful …….

边栏推荐
- Locust性能测试 —— 环境搭建及使用
- 283. Moving zero-c and language assisted array method
- HUAWEI nova 10系列发布 华为应用市场筑牢应用安全防火墙
- 我在linux里面 通过调用odspcmd 查询数据库信息 怎么静默输出 就是只输出值 不要这个
- i.MX6ULL驱动开发 | 24 - 基于platform平台驱动模型点亮LED
- The use of complex numbers in number theory and geometry - Cao Zexian
- 现在mysql cdc2.1版本在解析值为0000-00-00 00:00:00的datetime类
- Why should garment enterprises talk about informatization?
- Logo special training camp section 1 Identification logo and logo design ideas
- KDD2022 | 什么特征进行交互才是有效的?
猜你喜欢

Enabling digital economy Fuxin software attends the BRICs high level Forum on Sustainable Development

Energy momentum: how to achieve carbon neutralization in the power industry?

B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条

close系统调用分析-性能优化

常用的开源无代码测试工具
【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】

LOGO特训营 第三节 首字母创意手法

Locust性能测试 —— 环境搭建及使用

Use blocconsumer to build responsive components and monitor status at the same time

Huawei Nova 10 series released Huawei application market to build a solid application security firewall
随机推荐
Mysql root 账号如何重置密码
删库不必跑路!详解 MySQL 数据恢复
php短视频源码,点赞时会有大拇指动画飘起
微服务--开篇
MySQL存储数据加密
With this PDF, we finally got offers from eight major manufacturers, including Alibaba, bytek and Baidu
30余家机构联合发起数字藏品行业倡议,未来会如何前进?
常用的开源无代码测试工具
LOGO特训营 第五节 字体结构与设计常用技法
Force buckle 3_ 383. Ransom letter
Tiktok actual combat ~ the number of comments is updated synchronously
【Acwing】第58场周赛 题解
Convolutional neural network model -- lenet network structure and code implementation
Locust性能测试 —— 环境搭建及使用
The use of complex numbers in number theory and geometry - Cao Zexian
NAACL-22 | 在基于Prompt的文本生成任务上引入迁移学习的设置
Why is Dameng data called the "first share" of domestic databases?
Force buckle_ Palindrome number
醒悟的日子,我是怎么一步一步走向软件测试的道路
Introducing QA into the software development lifecycle is the best practice that engineers should follow