Skip to content

Instantly share code, notes, and snippets.

@tcartwright
Created July 6, 2017 17:28
Show Gist options
  • Save tcartwright/a03441f8f7a80ab34029aeb221501cb6 to your computer and use it in GitHub Desktop.
Save tcartwright/a03441f8f7a80ab34029aeb221501cb6 to your computer and use it in GitHub Desktop.
Run SQLIO Tests
@rem resources
@rem http://www.brentozar.com/archive/2008/09/finding-your-san-bottlenecks-with-sqlio/
@rem http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=20163
@rem START MODIFICATION AREA START
@rem change the drive letter to match the desired drive to test
@set testfile=c:\testfile.dat
@rem change the number to the number of gb's to test with, this should be roughly the same size as your db
@set size=20
@rem the number of threads to use for the test
@set threads=8
@rem the number of seconds to take with each test
@set seconds=120
@rem END MODIFICATION AREA END
@%~d0
@cd "%~p0"
@set tod=%time::=-%
@set tod=%tod:.=-%
@rem convert the size from gb to mb, note: if I use the exact conversion (*1024) the file size ends up being much larger than intended
@set /a size=%size% * 1000
@echo %testfile% %threads% 0x0 %size% > param.txt
@echo #%testfile% %threads% 0x0 100 >> param.txt
@set logfilename="%~dp0sqlio-results-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%-%tod%.log"
@rem create the test file if it does not already exist
@if not exist "%testfile%" (
@echo.
@echo *** CREATING THE TEST FILE, THIS MAY TAKE A WHILE... ***
sqlio -kW -s10 -fsequential -t%threads% -o8 -b8 -LS -Fparam.txt timeout /T 10
)
@rem testfile does not exist even after we tried to create it. the path must be invalid.
@if not exist "%testfile%" (
@echo.
@echo.
@echo The test file was not properly created. Please check the testfile location in this batch file, and try again after editing the testfile location.
@pause
@goto :eof
)
@echo Run by------: %USERNAME% > %logfilename%
@echo Machine-----: %COMPUTERNAME% >> %logfilename%
@echo Start Date--: %date% %time% >> %logfilename%
@echo Test File---: %testfile% >> %logfilename%
@echo Size--------: %size% MB >> %logfilename%
@call :runsqlio "sqlio -kW -t%threads% -s%seconds% -o8 -frandom -b8 -BH -LS %testfile%" %logfilename%
@call :runsqlio "sqlio -kR -t%threads% -s%seconds% -o8 -frandom -b8 -BH -LS %testfile%" %logfilename%
@call :runsqlio "sqlio -kW -t%threads% -s%seconds% -o8 -fsequential -b64 -BH -LS %testfile%" %logfilename%
@call :runsqlio "sqlio -kR -t%threads% -s%seconds% -o8 -fsequential -b64 -BH -LS %testfile%" %logfilename%
@echo. >> %logfilename%
@echo End Date----: %date% %time% >> %logfilename%
@%windir%\system32\choice.exe /M "Do you wish to delete the test file now?" /t 30 /d y
@if ERRORLEVEL 2 goto :eof
@del /q /f "%testfile%"
@goto :eof
:runsqlio
@set cmdvar=%~1
@set logfile=%~2
@echo. >> "%logfile%"
@echo %cmdvar% >> "%logfile%"
%cmdvar% >> "%logfile%"
@tcartwright
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment