How not to produce a useful error message

I always tried to put in meaningful error messages, even for those “impossible” results, such as “whoops, that shouldn’t have happened”… :smiley: (including the name of the procedure/method and what it was doing).

I used to program Assembler (Z80, 6502, 68000 and x86). A few years ago, I worked for an advertising agency that also ran the eShops for several well known clothing brands. I joined as a freelancer to look at the corporate website for one of these brands. Then they asked me to look at their eShop code, because (with 4 front end servers on a load balancer and a mySQL server on the backend) it would collapse when the PayPal newsletter came out and more than 200 users started to look at the site! The db admin would have to restart the database every 2 minutes during the rush.

I had a look at the code and the database design. The problem was, most of the programmers were not database specialists, they were fresh out of uni, they could write good, readable code. Readable for humans. They had no idea of how the database worked or the underlying processors on the servers. They’d just tried slapping more and more indexes onto the tables, until the indexes were almost bigger than the dataset. It worked fine (<0.5 seconds to load) when they were testing, but as soon as there was load, the pages would take over a minute to load and the database server would bomb out.

I dropped most of the indexes and re-ordered the WHERE clauses in the key statements. I then went through their PHP code and re-ordered some of the IF statements (checking positive instead of negative), it makes a marginal difference on a single user machine, but those changes made a huge difference on the production servers.

When the next PayPal newsletter came out, the site was coping with over 200 users per server with response times of under 0.5 seconds.

My code was still easily readable, but was also easily readable for the computer. Understanding the underlying hardware, the operating system, the language and the database and how they all work together is very important, especially when it comes to heavy loads. That aspect seems to be missing from modern courses.

I held a workshop on optimization and after a week at the company, they offered me a full-time gig.

1 Like

As someone familiar with the Monty Python sketch “Four Yorkshiremen” (known in some places as “Four Millionaires”), I feel like the next post ought to start something like “When I were a lad…” :wink::joy:

A fax server (GFI Fax Server at the time) or fax server component (some random 3rd party I don’t remember) once gave the best error message ever:

“The Fax Server is toast! Game over, man, game over!”

No indication of what wrong. And, IIRC, you just open the program again and everything works fine. My boss and future boss were laughing their asses off when they saw it. Some time later, I was able to witness it myself working on that piece of junk.

2 Likes

Actually I AM a Yorkshireman.

Perfect! :+1:
I would have to be a fake one sadly, to take part in that sketch. Although I do have happy memories of a year spent working and living there during my Y2K endeavours.

Y2K is another entire topic we should open. I was made responsible for Y2K remediation for a Fortune 50 company, talk about a “heads you win, tails I lose” game!

1 Like

Eyup, ows tha bum f’ spots ?

1 Like