We called in The Avengers to protect the Unmetric Platform….well, sort of.
After watching The Avengers for the nth time, I got to thinking about what makes a superhero….well, super. Was it their capes? Their fancy gadgets? The fact that they were surprisingly comfortable with wearing their underwear as outerwear?
No, it was the fact that most Superheroes had a faithful assistant, someone they trust by their side, furiously working away to make sure things go according to plan. Batman has Alfred and Lucius Fox, Iron Man has Jarvis, Han Solo has Chewbacca (Rawwwrrrr!) and even Frodo Baggins had Samwise Gamgee… not to mention Aragorn, Gandalf, Legolas, Gimli….okay clearly Frodo didn’t have much to do.
A couple of days later, the marketing team and I stood in the pantry, testing Unmetric’s resident geniuses’ (read: the engineers) Math Skills for fun (What’s 146+56*345/48?), when I decided to venture into the verbal reasoning part of our quiz.
“What happens when the platform goes down?” I asked.
“Well, one of us will…,” started KK.
“And if you aren't there? What happens then?”
“There’s always someone looking out for us….or something,” he answered with as much mystery as an engineer could.
I asked KK to explain. His response reminded me of the superheroes and their trusted sidekicks. Now, I know comparing Unmetric to a superhero is overreaching, but over 30,000 brands’ social media efforts are benchmarked on the platform. That’s a lot of pressure on a platform! Okay fine, you can call Unmetric, ‘Superhero Light.’
KK’s explanation began by divulging a dark secret.
You might want to sit down for this.
Till very recently, Unmetric, with over 50 features and at least a million lines of code were running on servers that….let’s just say they were McGyver-ed quite a few times.
We did warn you to sit down!
So what would happen if one of these servers started acting a little wonky?
Touch wood, this hasn’t happened before — but picture everyone running around like Minions desperately trying to fix it. And after the fix, picture us eating our feelings whilst listening to Phil Collins.
The thought of this actually happening (and listening to Phil Collins) plagued the minds of KK and the engineering team. The more they thought about it, the more they realised they needed protection.
And trying to handle server problems by themselves was like Hawkeye trying to fight without the rest of The Avengers. No offense to Hawkeye, but he wouldn’t last very long on his own.
HAProxy >>>> Hulk
According to KK, Unmetric has three ways to protect the platform. The first way is to make sure all the work isn’t being done by one single server. Large, highly-used websites don’t operate on one server, for the simple reason that if it goes down, all hell breaks loose.
“We needed another server, to break its fall….a load-balancer,” explained KK.
“So kind of like how the Hulk is called in to fight only when the rest of The Avengers are in trouble? Because they need his brute strength?” my brain and mouth asked, desperately trying to bring back the conversation down to my level of intellect.
“Umm the Hulk, sure,” answered KK, “but we call our guy HAProxy.”
HAProxy is basically a safety net. Written in C, HAProxy is a Linux utility that is fast, efficient and is used by websites like Reddit, Tumblr and Twitter.
“Primarily, we’re accepting traffic on our first server, but if the load on it goes beyond 90%, we start redirecting traffic to the second server. Load balancing solutions like HAProxy help us prepare for the mother of all worst-case scenarios,” said KK.
What’s the opposite of Separation Anxiety?
But one solution isn’t nearly enough. Another way to relieve the load off the main server, is to have separate servers for certain features.
“So we have this Reports feature that can give people numbers and stats from years ago…but overusing this feature could slow the platform down….we felt that giving this feature its own server would take the heat off,” explained KK.
“Kind of like how each Avenger has his or her own signature move? Like Bruce Banner is a scientist and Tony Stark can fix anything, but we wouldn’t expect Captain America to know much about technology — nor Thor for that matter!” I rambled.
“If it makes you understand, then I guess that is a decent enough analogy,” he responded, shrugging.
But first, let me take a snapshot!
Completing the trifecta of protection, KK says, is replication. The platform has a primary database, but also has a replica database that is basically its personal assistant — its job is to make copies and coffee. Okay, I’m kidding about the coffee; the replica database is constantly taking snapshots of the platform’s activities. When the primary one goes down, the replica takes over by collating all the snapshots.
The primary/replica concept was inappropriately referred to as ‘Master-Slave,’ because, computer nerds. Anyway, the name was changed to ‘follower/leader’ and in June 2014, to its present name.
“So it’s like how Iron Man has that army of Iron-Men(?) to fight with him?”
“Stop trying to make everything about The Avengers….it isn’t like that! Wait… it kind of is. For once, that reference actually made sense,” said KK, walking away before I asked any more questions.
Servers will go down, there will be threats, new technologies will emerge, and our platform will be expected to perform harder, better, faster, stronger.
But as long as our Nick Fury aka KK and the engineering team assemble more techniques to serve and protect, I think the platform will be just fine.
Now if only I could convince KK to wear an eye-patch.