The case of the 82 seconds

Written by
Xavier GrosCTO
Published
6 min read
Tags
How we work

A search on the website was taking 82 seconds and there was already a first suspect on the table. The case could have been closed with a quick tweak. We followed it to the end.

Ilustración en acuarela de un tablero de corcho de investigación. En el centro hay un cronómetro plateado clavado con una chincheta, y de él salen hilos rojos hacia un billete de tren, un mapa con un punto rodeado en rojo, fotos de una estación, un túnel y un pueblo, la silueta de un hombre con sombrero, el dibujo de una mochila y notas manuscritas.
An 82-second search led us to a years-old fault (DB/AI).

The alert came in at night. The database behind a client’s website was working far harder than usual, and their hosting provider had found the reason: searches were taking 82 seconds on average to complete, while several bots fired them off one after another. By the next morning, the case was on our desk.

Less than an hour after the ticket was opened, we had replied with the real cause, a measurement that proved it and the exact list of what needed checking in production.

The fault itself is the least of it: two parts of the database that had not understood each other for years, and a flood of searches that made it obvious. What is worth telling is the work, because it is the part of support nobody sees when everything is running.

The first suspect is entitled to an alibi

Every case arrives with a first hypothesis. This one pointed at a specific part of the database, it was reasonable, and it came from the people who know the servers best. The easy thing would have been to tweak that part and wait and see.

We checked it first, and it was fine. We said so in the ticket, along with the reason: touching it was not going to fix anything. The client was spared a pointless change on a live website, with all its cost and risk. That never shows up in a report, and it is support work too.

Don’t touch the crime scene

We investigated in our development environment, with the same code and a copy of the real data. Meanwhile, the website kept serving its visitors without noticing a thing.

There we reproduced the problem, isolated it and tested the fix. The same searches became between 8 and 12 times faster and returned exactly the same results. The second part matters as much as the first, because a very fast search that finds something else is just another fault.

With that proof in hand, we were no longer asking anyone to trust our hunch.

One investigation, one thread

The hosting provider sees its servers and we see the website from the inside. Nobody sees everything from their own side, so a case like this only gets solved if both work together.

This was a good example. The provider had raised the alert in time and with data. In the ticket, we told them what to look at and what they should find if we were right. They checked it in both of their environments and confirmed it. They proposed a controlled test of the fix, and we added how to roll it back if anything went wrong. We also suggested stopping the bots before they reached the database, because the protection in place was not enough.

The client was in that thread from the start. They could see what was happening and who was handling it, and they never had to forward a single email from one provider to the other.

If the answer to all of them is "we restarted it and it works now", the case is still open.

To the end of the trail

Once the bots left, the load went back to normal. For practical purposes, there was no longer an incident, and that is exactly when many of them get closed. The cause was still there, waiting for the next bots.

There was also the question that separates fixing something from understanding it: why did it happen, and how do we stop it happening again? We answered it in the ticket the same day it was raised, after following the trail through the software’s history back to its origin. The culprit had been living in the house for years. It came from the version the website was built with, and we built that website, so we said so plainly.

Knowing the origin gave us what a patch never does: knowing exactly what needs fixing, confirming that a routine update would not have solved it, and being able to guarantee that whatever is created from now on will come out right.

Sentence pending enforcement

As we write this, the fix is going into a controlled test in pre-production. Before taking that step, we had already checked that the change was safe and put in writing what to do if anything went wrong. When it reaches production, it will be measured before and after, because that will be the figure that counts.

To gather all of the above, we have not had to touch production once.

Four questions for your support team

They apply to any incident on your website, whoever is handling it.

01Cause

Have they explained what is failing, or only what they did to make it stop showing?

02Proof

Is there a before and after measurement, or just a feeling that it is better now?

03Origin

Do you know since when it has been happening and why? Without that answer, nobody can tell you whether it will come back.

04Coordination

When the hosting provider and the website team are both involved, do they talk to each other or are you the one forwarding the emails?

If the answer to all of them is “we restarted it and it works now”, the case is still open.

Sources

For anyone who wants to get into the technical detail.

Shall we talk about your content?

Let's talk

At Digital Bakers this is how we write: human judgment up front and technology behind, pushing.