Monthly Archives: January 2010

Janitors Rule (down with high handed management)

A few years (almost a decade) ago in another telco that I was working at, I had an on the job conversation with my then manager.  I urged him to go talk to the shipping clerk to find out the skinny on how the company is really doing. As a result I was called a “bloody communist”  “Καλά είσαι κομμούνα ρε? “. That line was the conversation killer.

Well during this year’s AIFS conference in Athens, Wendy Goucher of Idrach ,said exactly that: “talk to the janitors, canteen caretakers and such personnel; they will tell you more or less how to fix your business”.

Now I am not privy to Mme. Goucher’s political opinions, but I do certainly feel vindicated that my gut feeling has been extensively studied in the field of psychology.

BTW. Many thanks to the organizers of AIFS, it was a good note comparing ground.


Two two liner performance boosters for web apps

Hear ye, hear ye, hark to the lazy masters’ cabin and partake of the wisdom of a traditional KISS .

I was writing a  CGI application in PERL for a project, yes I am indeed that old a hand, and I took a few optimization steps. First I installed mod_cgi and the perl fastcgi libs. Furthermore to exploit data locality in subsequent invocations of the scripts I hand crafted a hash based cache scheme.

While debugging the application I noticed that my  hand crafted cache was not being updated. After sleeping on it I realized that mod_cgi rotates each call to the script to a different instantiation of it in the pool it creates. What this effectively means is that I had as many hash based caches as the number of processes mod_cgi was spawning with no data locality between the different instances.

So OK I thought I need a shared memory segment and a way for my hash to reside on that segment. So after a bit of CPAN searching I got sharelite thus:

# shared memory segment for the global cache
use Tie::ShareLite qw( :lock );
my $ipc = tie my %CACHE,
‘Tie::ShareLite’, -key     => 2010,
-mode    => 0600,
-create  => ‘yes’,
-destroy => ‘yes’
or die(“Could not tie to shared memory: $!”);

But wait, since sharelite did all this work, I wondered  is there another module that can do all my intelligent caching work ? Here is another two liner that can save copious amounts of work,

use Memoize;

memoize(“DoDNS”,    SCALAR_CACHE => [HASH => %CACHE]);

So what I have now is a persistent shared memory cache of the invocations of the DoDNS function that is resilient even on application termination. And if you are concerned of hash initialization here is the final one liner.

delete @CACHE{keys %CACHE};

Done  in a very KISSable fashion.

Happy new year, health and prosperity for all the children

Happy new year to all peoples and creeds. At least those creeds that do not presume to hold the penultimate truth on pain of death.

Happy new year without suffering for the children.

Happy new year with plenty good food for all the children.

Happy new year with available health care for all the children.

Happy new year without hear/ear/tummy aches.

Happy new year without civilian casualties, maimed children and road side bombings.

Happy new year  and please grown ups, get it together, we are losing it!