A load testing tool for testing API endpoints using Node.js and the loadtest
package.
- Configurable requests per second (RPS)
- Support for testing multiple endpoints
- Random address selection from a predefined list
- Environment variable configuration
- Protocol-specific testing for DeFi positions
- Node.js
- npm or yarn
- Clone the repository
- Install dependencies:
yarn
- Setup the environment variables:
cp .env.example .env
Configure the following environment variables in .env
:
API_KEY
: Your API key for authenticationRPS
: Requests per second (default: 10)DURATION
: Duration of the test in seconds (default: 120)
- Set maximum file descriptors limit:
Before running load tests, increase your system's maximum file descriptors limit to handle multiple concurrent connections:
# Check current limit
ulimit -n
# Set new limit (example for 65535)
ulimit -n 65535
Note: The limit should be higher than your maximum expected concurrent connections. If you're unable to set the limit, you may need sudo privileges or to modify system configuration files.
yarn loadtest:holding
yarn loadtest:defi
yarn loadtest:defi
- Endpoint:
/tokens/sui/price
- Method: POST
- Batch Size: 50 tokens per request
- Concurrency: 10
- Duration: 120 seconds
- Endpoint:
/v2/address/{address}/holding
- Parameters:
chain
: SUIincludePnl
: false
- Concurrency: 10
- Duration: 60 seconds
- Endpoint:
/v2/address/{address}/positions
- Parameters:
protocol
: Multiple protocols supported
- Concurrency: 10
- Duration: 1200 seconds
- Supported protocols include:
- Aftermath Finance
- BlueMove
- Cetus
- FlowX
- Kriya
- Navi
- Scallop
- Native Staking
- SuiLend
- Turbos Finance
- Typus
- Alpha Fi
- Bluefin
- Elixir
- Sui NS
MIT