Skip to main content
The perf command enables performance testing of cloud native infrastructure using load generators like Fortio, wrk2, and Nighthawk.

Synopsis

mesheryctl perf [subcommand] [flags]

Subcommands

  • apply - Run a performance test
  • profile - Manage performance test profiles
  • result - View performance test results

Global Flags

--token
string
Path to Meshery auth token. Short form: -t
--output-format
string
Output format: json, yaml. Short form: -o
--yes
boolean
default:"false"
Assume yes for user interactive prompts. Short form: -y

apply

Run a performance test using existing profiles or command-line flags.

Usage

mesheryctl perf apply [profile-name] [flags]

Flags

--url
string
Endpoint URL to test (required with new profile)
--name
string
Name of the test
--mesh
string
Name of the service mesh infrastructure
--qps
string
Queries per second (0 for unlimited)
--concurrent-requests
string
Number of parallel requests
--duration
string
Test duration (e.g., 10s, 5m, 2h)
--load-generator
string
default:"fortio"
Load generator: fortio, wrk2, nighthawk
--file
string
Path to SMP-compatible test configuration file. Short form: -f
--body
string
Load test body (filepath or string). Short form: -b
--options
string
Additional options for load generator (JSON string or filepath)
--cert-path
string
Path to certificate for the load test
--disable-cert
boolean
default:"false"
Do not use certificate present in the profile

Examples

# Run test with existing profile
mesheryctl perf apply test-profile --url http://example.com

# Create new profile and run test
mesheryctl perf apply new-test --url http://192.168.1.15/productpage --qps 300 --concurrent-requests 2 --duration 30s

Sample Output

Initiating Performance test ...
Running test: stress-test
URL: http://example.com
Duration: 30s
Concurrent Requests: 2
QPS: 300

Test Completed!
Results:
  Requests: 9000
  Duration: 30.05s
  QPS: 299.5
  Latency (avg): 6.5ms
  Latency (p50): 5.2ms
  Latency (p99): 15.8ms

profile

Manage performance test profiles.

Usage

mesheryctl perf profile [profile-name] [flags]

Flags

--list
boolean
List all performance profiles
--view
boolean
View profile details
--delete
boolean
Delete a profile

Examples

# List all profiles
mesheryctl perf profile --list

# View in JSON
mesheryctl perf profile --list -o json

Sample Output

PERFORMANCE PROFILES:

Name: load-test-1
ID: 7e8b42f9-0e5c-4b7a-8f3d-9c2e1a6b5d4c
Endpoint: http://example.com
Load Generator: fortio
QPS: 100
Duration: 30s

Name: stress-test
ID: 8f9c53a0-1f6d-5c8b-9g4e-0d3f2b7c6e5d
Endpoint: http://api.example.com
Load Generator: wrk2
QPS: 500
Duration: 5m

result

View performance test results.

Usage

mesheryctl perf result [test-name] [flags]

Flags

--list
boolean
List all test results
--view
boolean
View detailed results
--output-format
string
Output format: json, yaml. Short form: -o

Examples

# List all test results
mesheryctl perf result --list

# List in JSON format
mesheryctl perf result --list -o json

Sample Output

TEST RESULTS:

Test: stress-test
Profile: load-test-1
Date: 2024-03-10 14:30:00
Duration: 30.05s

Metrics:
  Total Requests: 9000
  Successful: 8950 (99.4%)
  Failed: 50 (0.6%)
  QPS (actual): 299.5
  
Latency:
  Average: 6.5ms
  Min: 2.1ms
  Max: 125.3ms
  p50: 5.2ms
  p90: 10.8ms
  p95: 13.2ms
  p99: 15.8ms

Load Generators

Meshery supports three load generators:

Fortio (Default)

  • Best for: General-purpose load testing
  • Features: Uniform request distribution, detailed latency histograms
  • Options: MethodOverride, Headers, etc.
mesheryctl perf apply test --load-generator fortio --url http://example.com

wrk2

  • Best for: High-throughput testing
  • Features: Constant throughput, scriptable with Lua
  • Options: DurationInSeconds, Thread, etc.
mesheryctl perf apply test --load-generator wrk2 --url http://example.com

Nighthawk

  • Best for: Advanced HTTP/2 and gRPC testing
  • Features: Precise request pacing, detailed metrics
  • Options: requests_per_second, max_pending_requests, etc.
mesheryctl perf apply test --load-generator nighthawk --url http://example.com

SMP Configuration File

Service Mesh Performance (SMP) compatible YAML file format:
smpVersion: v0.0.1
config:
  name: my-performance-test
  duration: 30s
  clients:
    - internal: false
      load_generator: fortio
      protocol: http
      connections: 2
      rps: 100
      endpoint_urls:
        - http://example.com
      body: |
        {"key": "value"}
service_mesh:
  type: 3  # Istio
  name: istio
Use with:
mesheryctl perf apply my-test -f smp-config.yaml

Test Metrics

Performance tests provide comprehensive metrics:

Request Metrics

  • Total requests sent
  • Successful requests
  • Failed requests
  • Requests per second (actual vs target)

Latency Metrics

  • Average latency
  • Min/Max latency
  • Percentiles (p50, p90, p95, p99)
  • Latency histogram

Resource Metrics

  • CPU usage
  • Memory usage
  • Network throughput

Use Cases

Load Testing

# Sustained load test
mesheryctl perf apply load-test \
  --url http://api.example.com \
  --qps 100 \
  --concurrent-requests 10 \
  --duration 10m

Stress Testing

# High QPS stress test
mesheryctl perf apply stress-test \
  --url http://service.local \
  --qps 1000 \
  --concurrent-requests 50 \
  --duration 5m

Baseline Testing

# Establish performance baseline
mesheryctl perf apply baseline \
  --url http://app.example.com \
  --qps 50 \
  --duration 30s

Comparison Testing

# Test before optimization
mesheryctl perf apply before-optimization --url http://api.example.com

# Apply optimizations
# ...

# Test after optimization
mesheryctl perf apply after-optimization --url http://api.example.com

# Compare results
mesheryctl perf result before-optimization --view
mesheryctl perf result after-optimization --view

Best Practices

Test Planning

  • Start with low QPS and gradually increase
  • Run tests for sufficient duration (minimum 30s)
  • Test during different times of day
  • Establish baseline before changes

Resource Monitoring

  • Monitor target service resources during tests
  • Track load generator resource usage
  • Watch for throttling or rate limiting

Profile Management

  • Create reusable profiles for common tests
  • Use descriptive profile names
  • Document test objectives in profile descriptions
  • Version control SMP configuration files

Troubleshooting

Test Fails to Start

# Verify URL is accessible
curl http://example.com

# Check Meshery logs
mesheryctl system logs

# Verify profile exists
mesheryctl perf profile --list

High Error Rate

# Reduce QPS
mesheryctl perf apply test --url http://example.com --qps 10

# Reduce concurrent requests
mesheryctl perf apply test --url http://example.com --concurrent-requests 1

# Check target service logs and resources

Certificate Errors

# Provide certificate path
mesheryctl perf apply test --url https://example.com --cert-path /path/to/cert.pem

# Disable certificate validation (testing only)
mesheryctl perf apply test --url https://example.com --disable-cert

Load Generator Not Found

# Verify available load generators
mesheryctl perf apply test --help

# Use default Fortio
mesheryctl perf apply test --url http://example.com --load-generator fortio

See Also