Don’t Forget the Database

The other day, I was having a discussion with the CTO of another company about the issues that they were experiencing when they had spikes in traffic. They had tried solutions involving CQRS, queueing, etc, but they were still having issues with the spikes in volume. I followed up with the CTO and she said she had managed to solve the issue by tuning various database queries.

It reminded me of the time when I was the Chief Architect of a “megacorp”. At that time, I controlled the consulting dollars for Microsoft. My predecessors would happily accept those hours and the bills that Microsoft gave them, but I examined every hour with a fine-toothed comb. At year-end, I managed to have a surplus of consulting hours which I needed to use. I brought in a team of consultants to examine some of our slowest apps.

It seems that there were a lot of issues related to the way that our databases were being used. Extremely inefficient queries. Non-existent indexes. These consultants went to work, and managed to reduce a very painful operation from 70 seconds to 3 seconds!

When you are doing exercises in improving performance, don’t ignore the most basic part of a system. There can be gold in bringing in a specialist to look at the queries which have been running your systems for years.