This document is intended for application developers and database administrators who plan to evaluate performance for any computer hosting a SQL Server instance.
ContextLet’s say a new physical server has been delivered and we have to test its performance in regards to its future destination, which is a database server. For newbies, there are a lot of questions that emerge:
What has to be tested? What solutions can be used? What information do they provide? How to use them? Is there a tool that does all the tests I need to get a good insight into server performance or is it better to use two or more tools in conjunction?Most questions out there should lead us to following steps:
Definition of the scope of the test Analysis and selection of the tools available to achieve test purposes If not already done, creation of a performance report template Usage of this report template to build actual performance tests report for the server Actual performance test with results documentation in report Analysis of performance test results (compared to a baseline) Feedback on report template for continuous improvement Example of performance testing toolsThere is a bunch of tools that we can use to do a performance test:
General purpose testing: PassMark PerformanceTest CPU-z CrystalDisk Mark Phoronix Test Suite Database-related testing: Sqlio.exe HammerDb OStressIn conjunction with these tools, it’s worth using a database monitoring tool so that we can collect and historize performance statistics. Here are some of the tools that can be used:
sp_BlitzFirst windows Performance Monitor (perfmon) ApexSQL Monitor Idera Diagnostic ManagerHere are the choices made for the purpose of this article:
PassMark PerformanceTest to get a first overview of overall server performance Benchmarking with HammerDb and collecting performance statistics with sp_BlitzFirst. Getting server performance overview with PassMark PerformanceTestThe latest version for this tool is the 9 th and can be downloaded for testing (and purchase) on its dedicated web page .
The installation is pretty straightforward, so it won’t be reviewed here.
Once PerformanceTest is installed, we can launch it. We will get following window.

As we can see, there are multiple options available. We will just click on “Run Benchmark” to run all the tests. We are prompted following message to which we can answer “Yes”.

And the benchmark begins…

Once the tests are done, you will get a score that you can compare to others or between computers in order to evaluate performance.

Note
In this example, the 3D Graphics Mark is grayed because I did the test on a virtual machine without 3D acceleration.
If we get to detailed test data, we can see that there is a preamble testing for database operations:

Performance testing with HammerDb HammerDb Installation Process
Go to https://www.hammerdb.com/download.html to get back the latest version of HammerDB.
The installation process is straightforward and won’t be discussed.
SQL Server Performance statistics collection Collection stored procedureWhile HammerDb is running, we will collect performance statistics using the sp_BlitzFirst stored procedure from the open source project called SQL Server First Responder Kit .
So, the first step is to get back latest version of this stored procedure and set this up to the target SQL Server instance we will be testing.
Preferably, this procedure should be installed in a database reserved to DBA usage, let’s call it [DBAMGMT].We can check the stored procedure actually works with following statement:
EXEC dbo.sp_BlitzFirst @Seconds = 5, @OutputDatabaseName= 'DBAMGMT', @OutputSchemaName= 'Monitoring', @OutputTableName = 'BlitzFirstResults', @OutputTableNameFileStats= 'BlitzFirstResults_FileStats', @OutputTableNamePerfmonStats = 'BlitzFirstResults_PerfmonStats', @OutputTableNameWaitStats= 'BlitzFirstResults_WaitStats' ; Automating collection with a SQL Agent JobThis statement will be used to define a SQL Server Agent Job that will run every 10 seconds during the whole performance test.
Here is the code to create such a job:
USE [msdb] GO /****** Object:Job [BlitzFirst - Collection]Script Date: 17-04-18 14:37:26 ******/ IFEXISTS (SELECT job_id FROM msdb.dbo.sysjobs_view WHERE name = N'BlitzFirst - Collection') EXEC msdb.dbo.sp_delete_job @job_name = 'BlitzFirst - Collection', @delete_unused_schedule=1 GO /****** Object:Job [BlitzFirst - Collection]Script Date: 17-04-18 14:37:26 ******/ BEGIN TRANSACTION DECLARE @ReturnCode INT SELECT @ReturnCode = 0 /****** Object:JobCategory [[Uncategorized (Local)]]Script Date: 17-04-18 14:37:26 ******/ IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' AND category_class=1) BEGIN EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=N'[Uncategorized (Local)]' IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback END DECLARE @jobId BINARY(16) select @jobId = job_id from msdb.dbo.sysjobs where (name = N'BlitzFirst - Collection') if (@jobId is NULL) BEGIN EXEC @ReturnCode =msdb.dbo.sp_add_job @job_name=N'BlitzFirst - Collection', @enabled=0, @notify_level_eventlog=2, @notify_level_email=2, @notify_level_netsend=0, @notify_level_page=0, @delete_level=0, @description=N'No description available.', @category_name=N'[Uncategorized (Local)]', @owner_login_name=N'sa', @notify_email_operator_name=N'The DBA Team', @job_id = @jobId OUTPUT IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback END /****** Object:Step [Run Sp_BlitzFirst with statistics collection]Script Date: 17-04-18 14:37:26 ******/ IF NOT EXISTS (SELECT * FROM msdb.dbo.sysjobsteps WHERE job_id = @jobId and step_id = 1) EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'Run Sp_BlitzFirst with statistics collection', @step_id=1, @cmdexec_success_code=0, @on_success_action=1, @on_success_step_id=0, @on_fail_action=2, @on_fail_step_id=0, @retry_attempts=0, @retry_interval=0, @os_run_priority=0, @subsystem=N'TSQL', @command=N'EXEC Monitoring.sp_BlitzFirst @Seconds = 5, @OutputDatabaseName= ''DBAMGMT'', @OutputSchemaName= ''dbo'', @OutputTableName