Beginner’s Guide to Performance Testing: A Complete Tutorial from Load Testing to Stress Testing
A Complete Guide to Getting Started with Performance Testing - Covers load testing, stress testing, and soak testing, introduces the practical usage of the three major tools JMeter, k6, and Locust, and learns to identify system bottlenecks from scratch to ensure online stability.
This article provides an introductory guide to performance testing. Actual tool selection and testing strategies need to be adjusted based on project needs.
Why performance testing is needed
Four Types of Performance Testing
Key indicators for performance testing
-
›
Response Time
P50 (median), P95, P99 quantile. P99 reflects real user experience better than average
-
›
Throughput
Requests per second (RPS). Represents the processing power of the system
-
›
Error Rate
The proportion of failed requests. Error rates should not increase rapidly when load increases
-
›
Concurrent Users
Number of users online at the same time
-
›
Resource usage
CPU, memory, disk I/O, network bandwidth usage
Comparison of three major performance testing tools
-
›
advantage
GUI operation is intuitive, rich in plug-ins, and supports multiple protocols (HTTP, FTP, JDBC, SOAP)
-
›
shortcoming
Writing in Java consumes resources, has high script maintenance costs, and is not suitable for version control.
-
›
Suitable
Introductory learning, GUI operation required, QA with non-engineering background
-
›
advantage
The script is written in JS, easy to read and maintain, CLI execution is suitable for CI/CD, and the resource consumption is low.
-
›
shortcoming
Only supports HTTP/WebSocket/gRPC, does not support GUI recording
-
›
Suitable
Modern Web API testing, CI/CD integration, QA with programming background
-
›
advantage
Rich Python ecosystem, easy distributed execution, and real-time monitoring via Web UI
-
›
shortcoming
Python GIL limits stand-alone performance and requires Python knowledge
-
›
Suitable
Python technology stack team needs complex user behavior simulation
Practical process of performance testing
-
›
Home page loading time must be within 2 seconds (P95)
Home page loading time must be within 2 seconds (P95)
-
›
API response time must be within 200ms (P99)
API response time must be within 200ms (P99)
-
›
The system must support 5000 simultaneous users
The system must support 5000 simultaneous users
-
›
Error rate must be less than 0.1%
Error rate must be less than 0.1%
-
›
Hardware specifications should be consistent with the production environment (or scaled down and converted)
Hardware specifications should be consistent with the production environment (or scaled down and converted)
-
›
The database should have test data close to the real level
The database should have test data close to the real level
-
›
Turn off unnecessary monitoring and logs to avoid interfering with results
Turn off unnecessary monitoring and logs to avoid interfering with results
-
›
Analyze traffic patterns in production (which APIs are called most often)
Analyze traffic patterns in production (which APIs are called most often)
-
›
Define user behavior path (browse home page → search → view products → add to shopping cart)
Define user behavior path (browse home page → search → view products → add to shopping cart)
-
›
Set a reasonable thinking time (the time the user stays on the page)
Set a reasonable thinking time (the time the user stays on the page)
-
›
Prepare test data (different accounts, different products)
Prepare test data (different accounts, different products)
-
›
Monitor server metrics using Grafana + Prometheus
Monitor server metrics using Grafana + Prometheus
-
›
Observe database slow query logs
Observe database slow query logs
-
›
Log errors in the application log
Log errors in the application log
-
›
Pay attention to garbage collection (GC) frequency and pause time
Pay attention to garbage collection (GC) frequency and pause time
-
›
Compare actual data to performance goals
Compare actual data to performance goals
-
›
Find the bottleneck (is it CPU, memory, database or network)
Find the bottleneck (is it CPU, memory, database or network)
-
›
Provide specific optimization suggestions and priorities
Provide specific optimization suggestions and priorities
-
›
Record baseline data as the basis for subsequent regression comparisons
Record baseline data as the basis for subsequent regression comparisons
Common performance bottlenecks and solutions
-
›
Database query is slow
Add indexes, optimize queries, and use cache
-
›
memory leak
Use profiler to find leaks and check for unreleased resources
-
›
Connection pool exhausted
Adjust the size of the connection pool and check whether the connection is returned correctly
-
›
CPU fully loaded
Identify CPU-intensive operations and consider asynchronous processing or horizontal scaling
FAQ
QA 工程師的一天:從手動測試到自動化的完整流程
分享 QA 工程師的日常工作,從需求分析、測試案例設計、手動測試執行到自動化測試導入的完整經驗。
Shift-Left Testing Strategy: A practical method to find bugs earlier and at lower cost
Shift-Left Testing Strategy Practice Guide - Advance testing to the early stages of development, covering requirements review, TDD, static analysis, Code Review and other methods to fundamentally reduce software defects and repair costs
API 測試入門:用 Postman 和 pytest 打造你的第一個 API 測試
API 測試是現代 QA 必備技能。從 HTTP 基礎概念到實際用 Postman 和 pytest 寫測試,帶你踏出 API 測試的第一步。
General Disclaimer
The information provided on this site is for reference only. We do not guarantee its completeness or accuracy. Users should determine the applicability of the information on their own.