当前位置:网站首页>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
边栏推荐
- [Galaxy Kirin V10] [desktop and server] FRP intranet penetration
- Advanced order of function
- On binary tree (C language)
- Architecture introduction
- Huge number multiplication (C language)
- [Galaxy Kirin V10] [desktop] build NFS to realize disk sharing
- When I forget how to write SQL, I
- Online troubleshooting
- Error C4996 ‘WSAAsyncSelect‘: Use WSAEventSelect() instead or define _ WINSOCK_ DEPRECATED_ NO_ WARN
- Jemeter plug-in technology
猜你喜欢
Discussion | has large AI become autonomous? Lecun, chief scientist of openai
[Galaxy Kirin V10] [desktop and server] FRP intranet penetration
[Galaxy Kirin V10] [server] NFS setup
MFC document view framework (relationship between classes)
[Galaxy Kirin V10] [server] NUMA Technology
Architecture introduction
Deepmind proposed a Zuan AI, which specially outputs network attack language
Linked list operation can never change without its roots
Remove linked list elements
[Galaxy Kirin V10] [desktop] can't be started or the screen is black
随机推荐
Leetcode48. Rotate image
Rhcsa12
Evolution from monomer architecture to microservice architecture
Time complexity and space complexity
How do microservices aggregate API documents? This wave of show~
First article
Talk about scalability
Application and Optimization Practice of redis in vivo push platform
/*Write a loop to output the elements of the list container in reverse order*/
How to use diff and patch to update the source code
[test theory] test phase analysis (unit, integration, system test)
RHCE - day one
JMeter correlation technology
/*Write a function to open the file for input, read the contents of the file into the vector container of string class 8.9: type, and store each line as an element of the container object*/
Architecture introduction
Summary of several job scheduling problems
Ten key performance indicators of software applications
[Galaxy Kirin V10] [server] iSCSI deployment
How to quickly parse XML documents through C (in fact, other languages also have corresponding interfaces or libraries to call)
Open the neural network "black box"! Unveil the mystery of machine learning system with natural language