Skip to main content
This guide will walk you through running your first stress test with SQL Query Stress. We’ll cover both the CLI and GUI approaches.

Run Your First Stress Test

1

Generate Sample Configuration

Create a sample configuration file to use as a starting point:
sqlstresscmd -x
This creates a sample.json file in your current directory.
2

Review the Configuration

Open sample.json to see the configuration structure:
sample.json
{
  "CollectIoStats": true,
  "CollectTimeStats": true,
  "CommandTimeout": 0,
  "ConnectionTimeout": 15,
  "DelayBetweenQueries": 0,
  "EnableConnectionPooling": true,
  "ForceDataRetrieval": false,
  "KillQueriesOnCancel": true,
  "MainDbConnectionInfo": {
    "ApplicationIntent": 0,
    "ConnectTimeout": 15,
    "Database": "Northwind",
    "EnablePooling": true,
    "IntegratedAuth": false,
    "Login": "dbUser",
    "MaxPoolSize": 2,
    "Password": "!Se8ret",
    "Server": ".\\SQLEXPRESS"
  },
  "MainQuery": "SELECT * FROM Customers",
  "NumIterations": 10,
  "NumThreads": 1,
  "ParamDbConnectionInfo": {
    "ApplicationIntent": 0,
    "ConnectTimeout": 0,
    "Database": "",
    "EnablePooling": true,
    "IntegratedAuth": true,
    "Login": "",
    "MaxPoolSize": 0,
    "Password": "",
    "Server": ""
  },
  "ParamMappings": [],
  "ParamQuery": "",
  "ShareDbSettings": true
}
3

Customize Connection Settings

Edit the MainDbConnectionInfo section to match your SQL Server instance:
"MainDbConnectionInfo": {
  "Server": "localhost",
  "Database": "YourDatabase",
  "IntegratedAuth": true,
  "Login": "",
  "Password": "",
  "EnablePooling": true,
  "ConnectTimeout": 15
}
Set IntegratedAuth to true for Windows Authentication, or false and provide Login and Password for SQL Authentication.
4

Customize Your Query

Update the MainQuery field with your test query:
"MainQuery": "SELECT * FROM YourTable WHERE YourCondition = 1"
5

Configure Load Parameters

Set the number of threads and iterations:
  • NumThreads: Number of concurrent connections (e.g., 10 for 10 concurrent users)
  • NumIterations: Number of times each thread executes the query (e.g., 100)
"NumThreads": 10,
"NumIterations": 100
6

Run the Stress Test

Execute the stress test with your configuration:
sqlstresscmd -s sample.json -t 1
The -t 1 parameter specifies a 1-second timeout between status updates.
7

Review Results

The tool will display real-time progress and a summary when complete, including:
  • Total execution time
  • Queries executed per second
  • Average query duration
  • I/O statistics (if CollectIoStats is enabled)
  • Time statistics (if CollectTimeStats is enabled)

Expected Output

You should see output similar to this:
Starting stress test...
Threads: 10 | Iterations: 100
Progress: [==================] 100%

Summary:
- Total queries: 1000
- Duration: 45.2 seconds
- Queries/sec: 22.1
- Avg duration: 452ms

Configuration Options

  • CollectIoStats: Collect SQL Server I/O statistics (logical reads, physical reads)
  • CollectTimeStats: Collect execution time statistics
  • EnableConnectionPooling: Enable ADO.NET connection pooling
  • ConnectionTimeout: Seconds to wait for connection before timeout
  • MaxPoolSize: Maximum number of connections in the pool
  • CommandTimeout: Query timeout in seconds (0 = no timeout)
  • DelayBetweenQueries: Milliseconds to wait between query executions
  • ForceDataRetrieval: Force retrieval of all result data
  • KillQueriesOnCancel: Kill running queries when test is cancelled
Use ParamQuery and ParamMappings to execute queries with dynamic parameters:
  • ParamQuery: Query that returns parameter values
  • ParamMappings: Map parameter columns to query parameters
  • ParamDbConnectionInfo: Connection settings for parameter query (or use ShareDbSettings: true)

Tips for Effective Stress Testing

Start Small

Begin with low thread counts and iterations. Gradually increase load to understand your system’s limits.

Monitor Server Resources

Use SQL Server Management Studio or Performance Monitor to watch CPU, memory, and I/O while testing.

Test Realistic Scenarios

Use queries and parameters that mirror your actual application workload.

Collect Statistics

Enable I/O and time statistics to get detailed performance metrics.

Next Steps

Advanced Configuration

Learn about advanced configuration options and features

Best Practices

Discover best practices for SQL Server stress testing

Build docs developers (and LLMs) love