UPDATED 16:23 EDT / APRIL 14 2016


Give to get: Inside Facebook’s open source operation

Facebook doesn’t sell software, but it’s arguably the largest open source software company in the world.

In the last few years, the social network has accelerated its contributions to open source, providing not only code it uses in its own operations, such as its artificial intelligence software Torch, but also designs for servers and entire data centers. At the company’s F8 conference for developers and business partners this week, Facebook’s open source leaders announced continued progress on such projects as React Native, which helps developers use the same code on different operating systems.

Facebook Chief Executive Mark Zuckerberg has often talked up the way open source fits the company’s culture of sharing. And at F8, developer advocate Christine Abernathy outlined how Facebook depends on open source software for every pixel in its news feed.

In an Apr. 13 interview with SiliconANGLE, Facebook’s open source chief James Pearce (pictured) provided more details on the nature of Facebook’s own open source work, including the challenges of “making sure that engineers throughout the company behave themselves and do the right thing“ and the benefits to the company’s recruiting. Following is an edited version of the conversation:

Q: How do you run Facebook’s open source effort?

A: We have a very federated organization when it comes to open source. I have a small central team that builds a lot of the tooling and develops a lot of the best practices for doing open source. And they evangelize what we’re doing.

Then it’s literally hundreds of engineers throughout the company who are actually building the projects, interacting with the communities and so forth. In fact, when we’re deciding whether to open source something in the first place, that’s one of our key criteria: to make sure that the team that is launching it is not going to just throw it over the wall and forget about it but will continue to interact with the community and continue to support the technologies once they launch.

One of the arguably unique aspects of our open source program is that we only open source the projects that we’re using in production.

Q: That’s unusual?

A: Surprisingly it is. If you look at some large companies and the projects they have on (code repository] GitHub, you’ll get hackathon projects and engineers doing this or that on their own time.

We’re very happy for people to do hackathon projects, but our main open source portfolio is literally the Facebook stack [software platform]. You’re seeing our web servers, you’re seeing our databases, you’re seeing our analytics tools, front-end technologies, mobile view layers. In fact, with the Open Compute Project, we’re even open sourcing the hardware designs for our servers, the network and the data centers.

This is literally a window into our world. One of the beautiful things about this is that people understand that we’re going to keep maintaining the projects because we have to. That’s our job. The same React that we’re developing in the open on GitHub is the same version of React that we’re actually running on Facebook.com.

Q: How do you determine what to open source and what to keep in-house?

A: Generally we want to make sure it’s being used and prove that it works for us. If I get some random engineer coming to me and saying, “I’ve got this great little project I’ve built, can I open source it in my spare time?” Not really, though they’re welcome to do it on their own time under their own name. But the Facebook portfolio as a whole is really there to represent how we run ourselves as a business or a technology stack.

Q: So where do you draw that line on open source versus keeping it internal?

A: We don’t consider that much of our technology to be a competitive advantage. We have realized over the years that the more we share, the better. It allows us to innovate faster, it allows us to recruit and retain talented engineers who want to work on these kinds of problems, and it helps accelerate the industry as a whole. We don’t have a monopoly on smart ideas or ways to solve these problems. If other companies or people see these problems and maybe bring some solutions, then clearly we’re going to benefit.

Q: But Facebook does keep some things secret, such as its algorithms for surfacing news feed items, right?

A: Yeah, we’re not entirely sure how we’d open source that anyway. There are so many systems involved, and at our scale, it’s not always easy to pull out the modular pieces of the jigsaw.

But where we can, we do. A lot of the 350 projects we have on GitHub, when combined, do produce what you see in the news feed. We’re even open sourcing our artificial intelligence libraries–projects like Torch [a development environment for numerics, machine learning, and computer vision].

Q: Are there any examples you can cite where other companies advanced Facebook’s open source projects and that came back to help the company?

A: Frequently. Even small performance improvements, which at our scale can accrue to quite large benefits. One example is React. Companies like Khan Academy are starting to use React, our front-end Javascript library, and we were frequently getting performance benefits back in from Khan Academy.

The other one is [virtual machine] HHVM, our runtime environment that runs our entire fleet of web servers. We have helped companies like Wikipedia and Box use it, and they are also making improvements and tuning it for their own purposes, which they share back into the project.


React Native timeline

Q: Any key areas you’re focused on right now?

A: The one we’re most excited about is React Native. The adoption has been out of proportion to what we expected. We needed a way to have developers writing mobile apps quickly, and we underestimated how much of the community wanted to do exactly the same thing. From a standing start last year, we now have hundreds of thousands of engineers around the world, at companies large and small, who are building React Native apps for iOS, Android and, as of this morning, for Windows and Samsung devices.

We’re also open sourcing telecom projects, virtual reality, even a camera. All of these follow the same philosophy that if we share things, we can move things faster than if we kept them to ourselves.

Q: Has there been an evolution in how you develop code in the first place based on the expectation that you could open source it?

A: That is one of the unexpected benefits of open source. When I rebooted the program two or three years ago, where we were trying to tease pieces of infrastructure out from Facebook that we thought were eligible for open sourcing, that’s kind of tricky. You’ve got to identify the modules, take them out, make sure the code’s all clean.

Since then, we’ve really emphasized to teams that think they’re going to open source in the end to start thinking that way from the start.

Q: You mean to think modularly?

A: Exactly. Don’t entwine it into all of these other systems. Keep those boundaries nice and clear. Make sure the API [application programming interface] is super-clean. Make it super-modular. Improve the quality of the documentation, make sure it’s well-commented.

We now have so many engineers that are doing open source [projects] ready to take off the shelf means that technologies get adopted within the company more quickly. So it becomes an internal marketplace that helps to drive the meritocratic quality of all these things.

Q: So essentially, they’re not doing code in their pajamas.

A: We want to show people that we’re not just a bunch of hackers messing around, that we’ve got big-scale problems to solve and we’re taking them very seriously.

Facebook CEO Mark Zuckerberg at the F8 conference on Apr. 12 (Photo: Robert Hof)

Facebook CEO Mark Zuckerberg at the F8 conference on Apr. 12 (Photo: Robert Hof)

Q: I would think one challenge might be that you can get efficiencies inside a company from intertwining systems, so how do you persuade engineers not to opt for that kind of advantage?

A: There is a curve. In some cases we have tried to combine things to get scale. One example is our code base itself. Unlike many companies that have many little siloed projects, we have all of our code in one single source code repository. It’s fairly insane when you look at the amount of code we have.

But that gives us a lot more ability to move that single platform forward quickly rather than having a lot of siloed teams all over the place. And it’s part of our engineering culture, which is that we expect any engineer to be able to commit code to any other part of the company. That is quite unusual.

On the other hand, we have struggled in the past from too much intertwining of the logic of the code itself. So we try to strike a balance where the code is hosted all in one place but the design is still super-modular and you can still take a single subdirectory of that source code repository, share it out to GitHub, and it is a standalone valuable project.

Q: Any less obvious benefits of open source for Facebook and other companies?

A: New engineers coming into the workforce expect open source to be part of the engineering culture, to share the code internally and outside the company. Engineers love to be able to share their ideas. If you don’t have a strong, cohesive open source strategy, you’re going to find it a lot harder to recruit that talent. If you’re an enterprise or a CIO and you’re thinking about how to gear up your engineering organization for the next 10 years, you better get yourself an open source strategy.

Q: What companies don’t understand this yet?

A: The age of the company matters a lot. We were born in 2004, and when Mark sat down one evening and decided to build the first version of Facebook, he basically had two choices. Either he buys a whole lot of proprietary software and tries to build a website with that, or he uses open source technologies like Apache and MySQL and Linux. He just wants to get on with it, so he chooses the latter. We still have MySQL and Linux and a version of PHP.

If you’re a 100-year-old company, maybe that culture shift is a little harder. They haven’t taken that leap of faith.

Photo by Rob Hof

A message from John Furrier, co-founder of SiliconANGLE:

Show your support for our mission by joining our Cube Club and Cube Event Community of experts. Join the community that includes Amazon Web Services and Amazon.com CEO Andy Jassy, Dell Technologies founder and CEO Michael Dell, Intel CEO Pat Gelsinger and many more luminaries and experts.

Join Our Community 

We are holding our third cloud startup showcase on Sept. 22. Click here to join the free and open Startup Showcase event.

“TheCUBE is part of re:Invent, you know, you guys really are a part of the event and we really appreciate your coming here and I know people appreciate the content you create as well” – Andy Jassy

We really want to hear from you, and we’re looking forward to seeing you at the event and in theCUBE Club.

Click here to join the free and open Startup Showcase event.