How Facebook Runs Its LAMP Stack
prostoalex writes "At QCon San Francisco, Aditya Agarwal of Facebook described how his employer runs its software stack (video and slides). Facebook runs a typical LAMP setup where P stands for PHP with certain customizations, and back-end services that are written in C++ and Java. Facebook has released some of the infrastructure components into the open source community, including the Thrift RPC framework and Scribe distributed logging server."
As I recall, some of their code was made open source in 2007, although not deliberately.
Every few days I run into whole sections of core Facebook functionality that are just plain broken for hours. Earlier this week, my main page wouldn't load for most of the day. And every couple of weeks I'm greeted with a "Sorry, you can't log in right now." message.
As an architect, I decided to view the presentation so that I can learn new things about scalability and architecture. This presentation came across as very amateurish and lacks any serious technical depth.Facebook seems to be stitched together as a set of "solution de jour" technologies without any real architecture behind it. Too many languages, frameworks and other gems. These guys took the notion of the right language for the task to an extreme. I have to believe that code releases into production is a big challenge for these folks.
It sheds a light on the infrastructure at least. Their implementation may not be very bright, but that's quite enlightening nonetheless. Many others would just keep us in the dark.
I need new glasses.
Anyway, I think the answer is 'Simply by existing'?
About how much has Facebook saved by using Open Source Software? I ask because I am not familiar with licensing costs from competing solutions. Thanks!
To quote a joke on slashdot
"Is there anything Java cannot make slow."
Domestic spying is now "Benign Information Gathering"
Well, they have the now-classic problems of needing to add new features to draw more users, to keep users from getting bored, and especially to convince investors and advertisers that there's any growth market for them. This means constantly using their infrastructure in new ways: new database manipulations, new tables, new display utilities, and retaining compatibility across a broad range of clients and older applications. This inevitably slows down new releases.
"Every few days I run into whole sections of core Facebook functionality that are just plain broken for hours"
What response did you get when you reported it to the Bug Reporting site?
Ah, the sweet ironies (and hypocrisies) in life. There's something beautifully creepy about a person fighting so hard against the same thing they fought so hard to create. In today's case, the culprit is Mark Zuckerberg, the young man more responsible than perhaps any other for his generation's obsession with displaying itself publicly on the internet. The New York Times has reported that a judge turned down Facebook's request to have "unflattering documents" about Zuckerberg removed from the website of Harvard magazine 02138.
At the center of the issue is an article in 02138 about Facebook's evolution and the subsequent lawsuit from classmates asserting Zuckerberg stole the idea and computer source code to begin his own project. The New York Times calls the article "sympathetic to the plaintiffs's account and questions the validity of Mr. Zuckerberg's claims."
The 02138 article also contains Zuckerberg's handwritten application to Harvard, and a journal that "contains biting comments about himself and others."
Perhaps Gawker summarized it best, saying, "This is the same dude who made billions from a website that allows you to let everyone in your friend network know when you are peeing."
And now he's mad that a private persona he would like to keep that way has entered the public domain. Yes, the sweet ironies and hypocrisies in life: why do we love them so much?
"Facebook seems to be stitched together as a set of "solution de jour" technologies without any real architecture behind it. Too many languages, frameworks and other gems. These guys took the notion of the right language for the task to an extreme. I have to believe that code releases into production is a big challenge for these folks"
What's 'hodge podge' about a highly customized solution. It is precisely what LAMP is all about. It does seem to work for them and with Facebook supporting 200 million active users, it is a good example of an Open Source success, so they must be doing something right.
I know this should be the job of tags, but to help put this in context, remember the recent uptime comparison that showed Facebook with pretty decent availability compared to other social networking sites. I'd say it takes the admins a fair amount of disclipine and perseverance to attain those kinds of numbers. (of course, it probably has nothing to do with the uptime of their various sundry and mostly useless modules, but I'd guess that's a different set of admins than the ones that care for the core LAMP platform)
This almost makes Facebook geek "cool" in my book, but I guess all the non-geek "cool" kids who use it already think so.
Whatever they're doing, it's not working too well. Sure, they manage to serve the pages, but the user experience is confusing and it seems to take them forever to roll out new and improved versions.
That has little to do with the infrastructure and more to do with the site design. Please don't blame the sys engineers/admins for the poor interface design.
When I first saw the post, I though it said how Facebook RUINS its LAMP stack.
I think that has to do with my experience with the apps and how often things timeout in that regard. It's a little frustrating and I'm sure it has nothing to do with the guys at Facebook, but it is interesting to find how that third-party experience affects my subconscious.
Linux - because it doesn't leave that Steve Ballmer aftertaste.
Too paraphrase the answer:
"Sun's stock price plummet.
Well, I'll be - the first LAMPCJ Stack - make it too big to fail.
For all of you fellow architect bods out there, this is how you do it:
PHP - California, Texas and France
C++ - New Jersey and Tibet
Java - California, India, and Somalia
Now, what does this variable name in Somali represent?
Her lips were softer than a duck's bill, but her quacks
PHP is the most popular language on the planet for a good reason - transaction rate.
If code is written in any language such that the app cannot handle more than 12 transactions per second, it's time to find another profession instead of blaming the language.
Depending on the application, PHP can handle several hundred transactions per second, on *one* machine. It is common knowledge that Java requires far more resources to achieve a typical transaction rate, than PHP.
Her lips were softer than a duck's bill, but her quacks
While I think Facebook is nothing more than one big popularity contest, I have to agree.
At least most of the stuff on Facebooks website works.
With slashdot, half the time clicking on a comment to expand it doesn't work unless I refresh several times or copy and paste the link into a new browser.
The right hand sidebar will say 'freshmeat' and show stuff from linux.com and vice versa.
At first I thought this was because I still used IE and that was the problem, being that slashdot doesn't cater to IE users, fine. So after I switched to Chrome I figured it wouldn't be an issue, yet its not any different.
I still can't expect expanding a comment to work, I still get crap listed as fossfor.us showing freshmeat entries, 'get more comments' doesn't do shit half the time.
As I've said countless times, programming in PHP and using MySQL 99% of the time means you don't know what you are doing. There are, however, those few large sites that use it that can actually justify its usage because it fits, but only if you actually know what your doing.
I have websites powered by PHP, ASP.NET, ASP, Java, and C. Some of those are good fits for what they do, some of them aren't and I've learned that the hard way. I've also learned that in most cases things are written because a developer 'knows' a specific language. My personal opinion is, if you only 'know' one language, you aren't a programmer. A real programmer can use just about any language given a good reference manual, and can be proficient in that language rather quickly after starting to work with it.
Unfortunately, most people who call themselves programers, aren't. They just happen to be able to get by with a language they've been spoon fed in the past long enough to hack out some POS that barely manages to get the job done and will drive any sane programmer absolutely mad when they get stuck taking over after the original devs are found to be incompetent.
Makes you wonder how many online services have failed because of arrogance and ignorance of the developers.
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
That has little to do with the infrastructure and more to do with the site design. Please don't blame the sys engineers/admins for the poor interface design.
Well, the fact that they gave a talk about their LAMP stack tells you that they consider engineering more important than site design. Furthermore, a poor choice of infrastructure makes doing good site design hard.
And that's my point: Facebook is evidently driven by system stuff and programmers, while it should be driven by site design.
Clearly, $MY_SPECIALTY should drive the entire system! They made a big mistake by allowing $OTHER_SPECIALTY to take precedence. Everyone knows that only $MY_SPECIALTY should dominate all design plans. Duh.
If your site infrastructure is influencing how you design, you've made some sort of monolithic error along the way. Good code completely separates the content from the design. It's not like they've just hacked up a Wordpress install (which seems to go out of its way to tie content and design together) - Facebook employs hundreds if not now thousands of programmers; it's pretty safe to assume there's at least one UI/UX specialist on board as well.
All things considered, I'd actually say that Facebook's design is pretty decent, but that's of course a matter of opinion. A lot of the code that went into that design sucks, but that's what happens when you have to support IE6. Regardless, I think it's great that they're sharing knowledge about how they've managed to use and customize an infrastructure to support 200,000,000 users, especially with the amount of traffic they have to deal with. That's well beyond the scale that many governments have to worry about!
How are sites slashdotted when nobody reads TFAs?
It was a talk by the Director of Engineering to "an independent online community focused on change and innovation in enterprise software development".
Of course it was about their LAMP stack and backend infrastucture and not their site design...
Both Java and PHP are interpreted languages because this is how you create a cross-platform language.
Each gets compiled to bytecode which gets executed in a OS specific VM.
Jave bytecode is compiled manually. PHP bytecode is compiled automatically using an encoder. In both cases code is compiled once and reused.
We chose PHP for our website because of it's efficiency in terms of development (e.g. no class generation step for programmers) and execution overhead. You don't need as much memory or cpu to run a typical PHP server.
Frankly, most websites do not need an app server. Wikipedia uses PHP, not Java. It is not a 'simple' website that you say PHP is suited for.
Her lips were softer than a duck's bill, but her quacks
>Clearly, $MY_SPECIALTY should drive the entire system! They made a big mistake by allowing $OTHER_SPECIALTY to take precedence. Everyone knows that only $MY_SPECIALTY should dominate all design plans. Duh.
Awesome.
---
The user experience and flow at FB improved IMHO with the recent changes.
Furthermore, a poor choice of infrastructure makes doing good site design hard.
yeah, they obviously should have used RoR. that certainly scales better. oh, wait...
Stop Computers/Cars Analogies on S
With slashdot, half the time clicking on a comment to expand it doesn't work unless I refresh several times or copy and paste the link into a new browser. [...] At first I thought this was because I still used IE and that was the problem, being that slashdot doesn't cater to IE users, fine. So after I switched to Chrome I figured it wouldn't be an issue, yet its not any different.
if you're using the index2.pl (beta) in anything other than Firefox you're clearly an idiot. they state the support for that browser and the fact that it's beta should be enough of a hint to stop whining
if you're using the classic index and are having any of these problems you're lying through your teeth because they dont exist.
either way, you're an idiot.
Stop Computers/Cars Analogies on S
Well, now we see who is pumping M$ on Slashdot.
It looks like turfers are turning their poison pens towards Sun, just as near a decade ago they turned towards the late Novell.
Beta is broken and the link to classic doesn't work. Stop wasting our time or there won't be anybody left here.
This is both informative (a believable in-the-ball-park analysis of Facebook operational costs) & insightful (price is not enough to be the best solution)
Huh??? How do you make that out? Wordpress is just a content management system that spits out mostly almost plain text wherever you put a relevant PHP command. There's not much of what it outputs that contains any serious formatting - apart from a few situations where there's no real alternative.
There's also Cassandra, the Java based distributed database that they've made open-source - first on google code, and now as an apache project(in incubation).
I guess a story on /. with only 75 comments after 7 hours pretty much answers that question, eh?
Meh, not having an opinion on the capabilities of the Java system itself, anything which needs extra library Y that you aren't using yet is going to slow down while loading it though. I know that Java is even slower due to it being a virtual machine and not just a library of course. Most programs now days have ports for all three major OSes any way, at the same time computers keep getting faster making running things like Java less annoying, so I can't decide whether Java use will increase or not.
Promote true freedom - support standards and interoperability.
Well, the fact that they gave a talk about their LAMP stack tells you that they consider engineering more important than site design. Furthermore, a poor choice of infrastructure makes doing good site design hard. And that's my point: Facebook is evidently driven by system stuff and programmers, while it should be driven by site design.
Aditya Agarwal is Facebook's Director of Engineering. Infoq is a site about software engineering. This is a talk by a software engineer, hosted at a software engineering site. Of course it's about software engineering. That tells us nothing about Facebook's priorities vis a vis engineering and design.
Jeff Kaplan (Blizzard's Lead Game Designer) gave a talk about WoW quests at GDC. That doesn't mean that Blizzard thinks that PvE content design is more important than PvP class balance or graphics, it just means that the game designer is talking about his area of expertise in front of a crowd that's interested in his area of expertise. If I wanted to hear a Blizzard employee talk about graphics, I'd go to Nvision or something, and I'd listen to whoever Blizzard's graphics engine guy is, and if I wanted to hear about Blizzard's PvP class balance ideas, I'd look for talks by Greg Street (Ghostcrawler, their lead class balance guy)
If your site infrastructure is influencing how you design, you've made some sort of monolithic error along the way
I haven't, but Facebook evidently has.
All things considered, I'd actually say that Facebook's design is pretty decent
I find it confusing as hell, and so do most people I know.
I think it's great that they're sharing knowledge about how they've managed to use and customize an infrastructure to support 200,000,000 users,
Come on, scalability is off-the-shelf stuff these days.
Try actually benchmarking Java http://kano.net/javabench/ Server-side Java is one of the fastest scalable platforms available.
>at the same time computers keep getting faster making running things like Java less annoying
Luckily Sun has an answer for that, too: the next Java version is always more than compensating for faster computing :-(. Iremember that back in the days I timed JRE 1.0 or 1.1 to start within 3 seconds on a 486 (!). It takes longer to start JRE 1.6 on my state of the art dual core now.
Just to be different, I run: Linux, Lighttpd, Sqlite, Kepler
Homonyms are fun!
You're driving your car, but they're riding their bikes there.