DEV Community

Alex Spinov
Alex Spinov

Posted on

Artillery Has Free Load Testing — Here's How to Stress Test Your API in 5 Minutes

Your API works with 10 users. But what about 10,000? Artillery lets you find out before your users do.

What is Artillery?

Artillery is an open-source load testing toolkit. Write tests in YAML or JavaScript, simulate thousands of virtual users, get detailed performance reports.

Quick Start

npm install -g artillery
Enter fullscreen mode Exit fullscreen mode

Your First Load Test

artillery quick --count 20 --num 10 https://your-api.com/health
Enter fullscreen mode Exit fullscreen mode

YAML Configuration

config:
  target: "https://api.example.com"
  phases:
    - duration: 60
      arrivalRate: 5
      name: "Warm up"
    - duration: 120
      arrivalRate: 50
      name: "Peak load"

scenarios:
  - name: "Browse and Search"
    flow:
      - get:
          url: "/products"
      - think: 2
      - get:
          url: "/products/search?q=laptop"
          capture:
            - json: "$.results[0].id"
              as: "productId"
      - get:
          url: "/products/{{ productId }}"
Enter fullscreen mode Exit fullscreen mode

Key Features

  • HTTP, WebSocket, Socket.IO, gRPC support
  • YAML or JavaScript test scripts
  • Capture and reuse response data
  • Custom JS functions for complex scenarios
  • HTML reports with artillery report
  • CI/CD friendly

Need to load test scraping infrastructure? Check out my production-ready actors on Apify Store. For custom solutions, email spinov001@gmail.com.

Top comments (0)