← 返回命令列表

Linux command

loadtest 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Run load test

loadtest -c [10] -n [1000] [http://example.com/api]

Run with requests per second limit

loadtest -c [10] --rps [100] [http://example.com/api]

POST request with body

loadtest -c [5] -P '[{"key":"value"}]' -T 'application/json' [http://example.com/api]

说明

loadtest is a Node.js load testing tool for HTTP APIs. Generates configurable concurrent requests to measure server performance and identify bottlenecks. Reports latency percentiles, throughput, and error rates.

参数

-c _num_
Number of concurrent clients.
-n _num_
Total number of requests.
--rps _num_
Requests per second limit.
-t _seconds_
Maximum run time.
-P _body_
POST request body.
-T _type_
Content-Type header.
-H _header_
Custom header.
-k
Keep-alive connections.

FAQ

What is the loadtest command used for?

loadtest is a Node.js load testing tool for HTTP APIs. Generates configurable concurrent requests to measure server performance and identify bottlenecks. Reports latency percentiles, throughput, and error rates.

How do I run a basic loadtest example?

Run `loadtest -c [10] -n [1000] [http://example.com/api]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c _num_ do in loadtest?

Number of concurrent clients.