I was recently trying to simulate the performance implications of hashing vs encryption and wanted to simulate hundreds of sessions and 1000’s of requested on a username/password table. Most time developers and testers use a test harness for automating this kind of activity or use a load testing tool. I however am not a tester so ended up using the little know tool called Ostress.exe which comes as one of the command line utilities with RML.
You can download RML from here. Now RML is a tool that can be used for stress testing and replaying events on a SQL server however my focus for this particular blog is just the Ostress tool. One you install RML you can find the Ostress tool in the below path
The above screenshot shows the switches available for ostress.exe
The most commonly used are –S servername , -E windows authentication , –n ( number of connections) –r number of requests per connections , -I for the file that contains the query that you want to execute, -o for the output of the query , -d databasename
An example of how to use the utility is shown below
The output would look like below
The files can be found at the path of the –o switch where you will find one file for each session, the output of the command line is also logged in a log file.
The best feature of Ostress is that you can use it to run multiple sql files against the server to simulate a production workload. Simply by replace the –I switch file name with an asterisk as shown below.
While I am sure that most database professionals are aware of this tool , I wanted to write this post mainly for testers as well as junior DBAs who are probably testing the database using a single thread and never really simulating a CPU related workload or aware of the impacts of the query on concurrency.