Easy load testing using Management Studio

There is an easy way to open several connections to your SQL Server in order to perform load testing. You can use Management studio "Multiple Server Query Execution" feature. This feature is usually used to run the same query against multiple servers but we also can use it for a load or stress testing.
In the registered servers tab create a group with the same name as your server that you are planning to use for the load testing. Inside the group create 10 or more connections to the same server, just making sure that in the server alias field you add number to your server name otherwise Management Studio will not allow to create two server connections with the same alias. Easy way to add multiple connections is by editing Management Studio connections xml file that you can find in "C:\Users\<> \AppData\Roaming\Microsoft\Microsoft SQL Server\110\Tools\Shell\RegSrvr.xml", you can simply copy the connection multiple times, still changing alias name for each new connection.

After all connections have been created, right click on Group name and choose the "New query" option. Management studio will open a one window but everything that you will be executing through this window, will be executed in 10 different connections simultaneously against your server.




As you see in the status bar, at looks like you are connected to the 10 different servers which are, in fact, one.



In the results of any executed query, Management Studio by default will append another column with the server name alias, as you defined in the connection settings. Below you can see how many connections with the different SPIDs you are holding.



You can change this behavior by going to Tools -> Options and select to stop adding server name to the results of each query.


In case you need more than 10 connections you can define more connections under the server group or open several Management Studio query windows.

Comments

Popular posts from this blog

SQL Awesomeness: Finding a QUALIFY query clause in the depths of the database ocean

Look back and realize how far you came

The Greatest Reasons to use or not to use a Centralized Data Access Architecture