当前位置:网站首页>Locust learning record I
Locust learning record I
2022-07-04 10:49:00 【weixin_ thirty-four million three hundred and twenty-two thousa】
Locust What is it? ?
Locust Is a relatively easy to use distributed user load testing tool
It's designed to ( Or other systems ) Load test , And determine how many concurrent users the system can handle ,Jmeter You can also deal with this scenario , But personal feelings Jmeter It's not as convenient as Locust major
Locust In English Chinese tense 【 grasshopper 】 It means :
The author's idea is , During the test , Put in a large group 【 grasshopper 】 Attack your website
Of course, the implementation can be used Locust Define each locust ( Or test users ) act , And through webUi Real time surveillance of the siege process
This will help you test and identify project bottlenecks before the project goes live
Locust It can make test engineers reply more professionally to developers and project managers :
You can imagine , When the project manager or leader asks you about the performance of the project , How much pressure can I bear ;
Your answer says that this project is in 2314 People visit at the same time , If you exceed that, you will hang up / Downtime / Make a mistake, etc , When in 1834 When people visit at the same time , It's going to slow down ; View of specific access time XXX
Does this answer seem to be more professional ?
Locust Operating principle
Locust The operation principle of is completely based on the event operation , So you can support thousands of concurrent users on one computer ;
Compared to many other event based applications , It doesn't use callbacks ( such as Nodesjs It belongs to callback ,Locust Do not use this logic )
contrary , He passed gevent【 coroutines 】 Use lightweight processes . Test that each locust on your site actually runs in its own process ( To be right , yes Greenlet)
This allows you to write python The code is simpler , Instead of going into something like JS The kind of callback region
Locust Characteristics of
use python Write a test plan
1. Don't need to UI Click foolishly on the interface , Just write the code normally
2.Locust Based on orchestration rather than callback , This will make your code similar to normal python Block code to execute synchronously
Distributed & Expand
1. Support simulation of hundreds of thousands of user behavior
2.Locust Support to run load tests on multiple computers ( You can run multiple machines in parallel )
3. Because based on events , Therefore, even a locust node can process tens of millions of users in a single process
4. But even if you simulate so many users , Not everyone is using your system at this frequency , Usually , Users will have time to think , Think about what to do next
Be careful !【 Requests per second 】 It's not equal to 【 Number of online users 】
The statistics are based on Web Interface
1.Locust There's a simple user interface , It can display relevant test details in real time
2. The statistical results interface is based on Web , Web pages are inherently cross platform , therefore Locust It's cross platform and easy to scale
Can test any 【 Webpage 】【 application 】【 System 】
1. Even if Locust It's for Web Of , It can test almost all projects
2. It only needs python Write the test method you want , And then put 【 grasshopper 】 Just execute the project that needs to be tested
Vulnerable to invasion
1.Locust The locusts released were very small , It's easy to be invaded , The development team has always intended to maintain this state
2. Time I/O All the heavy work of the project is entrusted to gevent
Locust Is completely based on python
http The request is entirely based on requests library ;
Locust Support http,https agreement , There's also support for other agreements ,webSocket etc.
Just use python Call the corresponding library
http/https use requests;
webSocket use webSocket;
Locust The creative background of
Locust Why create , It's because left and right are not satisfied with the existing performance testing solutions
The author believes that they have not solved the right problem , Failed to grasp the point
The author has tried Apache Jmeter and Tsung
Jmeter With one UI, Many people may think it's a good thing , Just a little bit ;
But through some click interfaces 【 code 】 Your test plan is a PITA
secondly ,Jmeter It's thread bound , This means that for every simulated user , All need a separate thread , This leads to , It is not feasible to simulate thousands of users on a computer for testing
On the other hand ,Tsung of no avail Erlang The thread problem of writing
It can take advantage of BEAM Lightweight technology provided by itself , And can happily expand the scale
But in defining the test plan ,Tsung and Jmeter Just as limited
It provides the basis XML Of DSL To define how users behave during testing ( This format is very Low, But it's intuitive ). When finished, display any kind of graphics and reports , You need to post process the logs generated by the test , That's the only way , You can understand how the test is conducted
Original address :Locust Tutorial - assi river
边栏推荐
- Recursive method to achieve full permutation (C language)
- Add t more space to your computer (no need to add hard disk)
- VI text editor and user rights management, group management and time management
- software test
- Personal thoughts on the development of game automation protocol testing tool
- PHP programming language (1) - operators
- Terms related to hacker technology
- Map container
- Es advanced series - 1 JVM memory allocation
- From programmers to large-scale distributed architects, where are you (2)
猜你喜欢
Sword finger offer 05 (implemented in C language)
Unittest+airtest+beatiulreport combine the three to make a beautiful test report
[Galaxy Kirin V10] [server] NFS setup
[Galaxy Kirin V10] [desktop] build NFS to realize disk sharing
DNS hijacking
Rhsca day 11 operation
Quick sort (C language)
C language structure to realize simple address book
Two way process republication + routing policy
20 minutes to learn what XML is_ XML learning notes_ What is an XML file_ Basic grammatical rules_ How to parse
随机推荐
Fundamentals of database operation
Huge number multiplication (C language)
Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
OSPF comprehensive experiment
The bamboo shadow sweeps the steps, the dust does not move, and the moon passes through the marsh without trace -- in-depth understanding of the pointer
Unittest+airtest+beatiulreport combine the three to make a beautiful test report
The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
Ten key performance indicators of software applications
Es entry series - 6 document relevance and sorting
Crawl Zhejiang industry and trade news page
[machine] [server] Taishan 200
What if the book written is too popular? Author of "deep reinforcement learning" at Peking University: then open the download
Using SA token to solve websocket handshake authentication
1. Circular nesting and understanding of lists
JMeter common configuration components and parameterization
Rhcsa operation
PHP programming language (1) - operators
DDL language of MySQL database: create, modify alter, delete drop of databases and tables
IPv6 comprehensive experiment
Design and common methods of test case documents