Back in 2006, I created a very simple tool called SQLQueryStress. The goal of this tool was to enable the user to test a single query under some form of load — up to 200 simultaneous threads.
I wrote this tool primarily for a book I was working on at the time, and used it for most of the examples therein. And after that, truth be told, I decided that the tool was not very useful. I use it for demos in almost every presentation I give — it’s great for showing simple contention scenarios — but I can’t say that I’ve used it even a single time in an actual work project.
Interestingly, although I personally haven’t found much use for it, many of you out there seem to have. The tool has become incredibly popular over time, and I’ve received numerous e-mails over the years requesting features, as well as many from people requesting and even offering to pay for the source code.
I’ve never said yes to any of these source code requests. For a long time I said no because I thought I might add more features and turn SQLQueryStress into something I could sell. Later, as my C# skills improved, I realized that the project was not very well done, and I really didn’t want to release garbage code with my name on it. Still later, I thought I’d lost the source code forever in a hard drive crash. Meanwhile, SQLQueryStress has limped along unchanged, even as the wish list has continued to grow.
Things changed last week, when I allowed one of my domains to expire; the one hosting SQLQueryStress. The domain was hosted by a very shady company that I’d long since decided to stop doing business with, and I found myself faced with the task of transferring things to a new provider. That is of course not a big deal, but I decided that the world would be better off without the current version of SQLQueryStress being quite so available. Almost 10 years after its creation — most of the work done over a long weekend — the world needs a better tool. I think it’s time for someone to step up and deliver. And that someone is not going to be me.
After the domain expired I went searching through my archives and found the source code. I took a quick look and confirmed what I thought all along: It’s pretty bad. But today I’m releasing it for free, and the old adage stands: You get what you pay for!
So here’s the official word: The attached source code is hereby released to the world, copyright and royalty free. You may use it, if you like, for whatever you want. Enjoy! If you use it for a public project, I would appreciate a mention in the acknowledgements section, but even that is not required. This source code is yours, warts and all. I was tempted to do some cleanup work, but at this point it’s just not something I’m ever going to touch again. I upgraded the project from Visual Studio 2005 to Visual Studio 2013, confirmed that it builds and seems to work, and that’s that.
I would very much like for someone to release a quality and modern stress tool. I would personally trash this source code and start with something brand new, but if you do use my code or even just my ideas as the base, here are the current top to-do items:
- Fix bug where SQLQueryStress tends to crash after the Stop button is hit. Some variable, I guess, is not being properly reset.
- Implement a better query editor. The control I used is bare bones to the max and does no one any favors.
- Apparently there are some bugs around the statistics creation options not getting properly turned off when you turn them off.
- Enable more than 200 simultaneous threads. This was just an arbitrary number and can be changed by simply modifying the appropriate control. But perhaps there is a smarter way to come up with a maximum?
- Implement support for saving of statistics and collected information, and reporting on that data, especially when the same test is run more than once.
- Implement support for multiple test queries.
If you have any questions about the source code… you’re out of luck. I haven’t looked at it in at least 8 years. So fire up your debuggers!
And finally, kindly let me know of any public projects you create, so that I can become an end user.
File Attachment: SQLQueryStress_9_7_1.zip