Advertisement
Canada markets closed
  • S&P/TSX

    22,167.03
    +59.95 (+0.27%)
     
  • S&P 500

    5,254.35
    +5.86 (+0.11%)
     
  • DOW

    39,807.37
    +47.29 (+0.12%)
     
  • CAD/USD

    0.7383
    -0.0003 (-0.04%)
     
  • CRUDE OIL

    83.11
    -0.06 (-0.07%)
     
  • Bitcoin CAD

    95,378.43
    -1,246.75 (-1.29%)
     
  • CMC Crypto 200

    885.54
    0.00 (0.00%)
     
  • GOLD FUTURES

    2,254.80
    +16.40 (+0.73%)
     
  • RUSSELL 2000

    2,124.55
    +10.20 (+0.48%)
     
  • 10-Yr Bond

    4.2060
    +0.0100 (+0.24%)
     
  • NASDAQ

    16,379.46
    -20.06 (-0.12%)
     
  • VOLATILITY

    13.01
    0.00 (0.00%)
     
  • FTSE

    7,952.62
    +20.64 (+0.26%)
     
  • NIKKEI 225

    40,369.44
    +201.37 (+0.50%)
     
  • CAD/EUR

    0.6835
    -0.0008 (-0.12%)
     

The 'risky bet' that saved Facebook hundreds of millions of dollars

drew paroski memsql facebook
drew paroski memsql facebook

(Paroski) MemSQL Architect Drew Paroski

Facebook went from 175 million users in February 2009 to 300 million in September that same year.

Most companies wouldn't consider that a problem. But Facebook was growing so fast, it literally couldn't order servers and hardware fast enough to handle the demand.

Sure, they could afford it, but they'd have to add so much capacity every day that the equipment wouldn't arrive in time.

It was a rare problem for Facebook: The kind that can't be fixed by throwing money at it.

That year, Facebook hired software engineer and computer scientist Drew Paroski, formerly of Microsoft and currently of hot startup MemSQL, to help come up with a solution.

Ones and zeroes

cyber binary
cyber binary

(REUTERS/Kacper Pempel) Binary code, as filtered through popular perception.

ADVERTISEMENT

To understand what Paroski does, it's useful to know a little bit about how programming works. You know how in movies and TV shows, a computer program just looks like a bunch of ones and zeroes?

"It's a gross oversimplification, but it's basically on point," Paroski says.

Every single programming language in the world — Java, C++, Facebook's favored PHP, and so on — has to be translated into those millions and millions of ones and zeroes such that the computer's processor can "understand" what the programmer wants it to do.

But that translation into ones and zeroes (what programmers call "machine code") takes time and energy for any computer. Programmers use what's called a "software compiler" to do the actual translation to machine code, and it's a crucial piece of the process.

An inefficient or sloppily-written compiler can tie up a computer or a server's resources, slowing everything down.

Multiply that effect by Facebook's "very large codebase," Paroski says, and you start to see why the social network's data centers were having trouble keeping up with demand.

But if you think about it the other way, Paroski says, there was a big opportunity here: A faster, more efficient software compiler would mean a faster, more efficient Facebook, and none of the programmers who actually work on the website would have to change a thing.

"It's this great point of leverage," Paroski says.

Hippity hoppity

Lulea data center 5 - Facebook data center
Lulea data center 5 - Facebook data center

(Facebook) A Facebook data center.

When Paroski joined Facebook in 2009, the company had already been attacking the problem with something called HipHop for PHP.

Facebook's whole website, to this day, is primarily written in PHP — a programming language as popular (for its flexibility) as it is reviled (for its inelegance). HipHop for PHP took Facebook's PHP code and translated it to C++ code, which was then compiled and ran.

It seems counterintuitive, but C++ is faster to compile than PHP, and so Facebook got back some of its server resources and bought itself a little time. But HipHop for PHP was having "diminishing returns" as far as performance went, Paroski says.

And with Facebook still growing rapidly, the clock was ticking down towards when their servers would once again hit capacity.

"Their data centers are getting slammed 24/7 with web requests," Paroski says.

Paroski and his small team came up with the idea for a successor to HipHop for PHP. It was called HipHop Virtual Machine, or HHVM, and it would take that PHP code and do the compilation itself.

It was a lot more efficient, and made life easier for developers who didn't have to worry about PHP code getting lost in translation when it was turned into C++ code.

Risky business

facebook vp infrastructure jay parikh
facebook vp infrastructure jay parikh

(Facebook) Facebook VP of Infrastructure Jay Parikh

It was a "risky bet" for Facebook, Paroski says. HipHop for PHP was a major part of the company's underlying infrastructure, and there was no guarantee that this new system would actually be any better.

But in 2010, VP of Infrastructure Engineering at Facebook Jay Parikh gave Paroski's team the go-ahead to start working on it.

In 2012, HipHop Virtual Machine was introduced to the world. At the same time, Facebook introduced Hack, its homegrown programming language that was basically a version of PHP designed to play nicely with HipHop Virtual Machine.

This was a big deal for Facebook. HipHop Virtual Machine meant that Facebook could slow down its spending on data centers and servers, because they could make much better use of what they already had.

In 2013, HipHop Virtual Machine was ready to go into production at Facebook and replace HipHop for PHP. No less than Mark Zuckerberg himself came by to join Paroski's team for the launch.

"It matters that much to Facebook," Paroski says.

Today

Eric Frenkiel
Eric Frenkiel

(MemSQL) MemSQL CEO Eric Frenkiel

In early 2014, Facebook's Parikh gave a talk where he announced that thanks to its efforts with optimizing its computing infrastructure Facebook had saved $1.2 billion.

Hundreds of millions of dollars of that savings comes from HHVM, and projects like Hack, the Open Compute Project (where Facebook is open sourcing the design of hardware used in its data centers), and other internal weird science projects contribute the balance.

What's more, Facebook released the code to HipHop Virtual Machine to open source, meaning that any developer in the world can download it and make their own tweaks and upgrades to it. Companies like Box, Wikipedia, and WordPress use HHVM to get their own speed and efficiency boosts.

Earlier this year, Paroski left the company to join a bunch of Facebook alumni at MemSQL, a nerdy-but-hot startup that has investors like Yelp founder Max Levchin, Box CEO Aaron Levie, Google Gmail inventor Paul T. Buchheit, and professional famous person Ashton Kutcher.

MemSQL makes fast, cheap databases that are challenging the likes of Oracle and SAP. It's a "juicy" challenge for Paroski, who describes himself as "entreprenurial." Just like at Facebook, he's specializing in working at the lowest levels of code to make everything work faster.

The eventual goal is for MemSQL to make a product that gives companies access to the kind of fast efficient technology Facebook and Google use, without their having to follow the Facebook method of making it themselves.

"Most companies are not Facebook or Google," Paroski says.

NOW WATCH: How to disable all the auto-play videos clogging your Facebook feed



More From Business Insider