Debugging Distributed Applications and Viagra

This morning I’ve been listening to the radio and the news were mixed with an infomercial by some urologist. While he was talking about erection, I was thinking about similarities with debugging distributed applications.

Here’s what I’ve learned (I do not remember the proper terms, but I got the point):

1. There are three reasons of erection problems: mental, physical and mixed.

2. Inexperienced doctors just prescribe Viagra.

3. But he (a good doctor), uses computers and techniques based on two

types of sleep to debug the issue and find the proper cure.

People have “deep ” and “shallow ” sleep, and during the deep sleep healthy men experience erection. So he asks his patients to sleep with a special computer that will “remember” if this patient had erection or not.

From a programming perspective, a human body is a super complicated multi-tier distributed application. I’m sorry for this analogy, but erection is sort of a user interface 🙂 If it does not happen, the end user is not happy.

So above “functional spec ” should translate into the following Java if-statement:

boolean wasErection, strong;

if (wasErection amp; amp; strong){

// the bug is in the mental tier,

// change the partner

} else if (!wasErection){

// the bug is in the physical tier,

// prescribe drugs A

} else{

// the bug is in both tiers,

// prescribe drugs B or change the partner

}

When you debug a multi-tier distributed application, which has, say performance problems, try to find the problematic tier and apply local fixes. But some people use “the Viagra approach”: upgrade the hardware (add more memory/processors), introduce clustering, etc. This solution helps for some time, but then another blue pill is needed… It’s always good to start with fine tuning of each application tier.

Viagra should be your last resort

Leave a comment