WhatsApp:我们如何用50人的团队搞定9亿用户?
本月初,WhatsApp的首席执行官Jan Koum在他的Facebook主页上发布了一条消息称已经有超过9亿用户正在使用他们公司提供的即时通讯应用服务。
然后Facebook的首席执行官马克·扎克伯格马上连发两条消息回应Koum。一条表示祝贺,另一条附上了一张他趁Koum在手机上输入那条消息内容时偷拍的照片,文字解释道:“看,这就是你发新消息时的抓拍!”
一年多前,扎克伯格和他的公司以190亿美元的价格买下这家创业公司,如今WhatsApp隶属于Facebook旗下。这一次收购意味着Facebook运行管理了互联网世界最流行的三大应用。
Facebook最初的社交网络服务在全世界有超过15亿用户;Facebook Messenger,后来从Facebook分离出来的即时通讯服务,如今也有7亿用户。但是Koum宣布的9亿里程碑则是属于WhatsApp自己的荣耀,与Facebook无关。
WhatsApp有很多值得聊一聊的故事。其中之一便是如此庞大的用户数量背后竟是一支让人意想不到精简团队。
当Facebook收购这家创业公司时,WhatsApp一共只有35名工程师,而那时候该应用的用户人数已然超过了4.5亿。直到今天,公司的工程师数量依然保持在50名左右,但是用户数量却翻了一倍,并且公司的大部分事情仍然全由这支精简的工程师团队独自处理。在这个互联网服务迅速扩张的世界,WhatsApp向我们展示了未来的发展之路——至少可以窥见部分。
WhatsApp很少谈及他们的工程细节,或者任何有关公司运营的内容。但是昨天,在加州的一次活动会上,WhatsApp的软件工程师Jamshid Mahdavi上台简单地向人们介绍了一番公司非同寻常的运作模式。
他提到的一点是他们编写WhatsApp所使用的程序设计语言叫Erlang。虽然Erlang不像其他程序设计语言那么流行广泛,但是它在处理大量用户之间的交流却是绰绰有余,而且还可以让程序员快速地写入新代码。但是Mahdavi表明不管模式如何,关键是态度和技术。
Mahdavi两年前加入WhatsApp的工程师团队,那时候公司刚刚成立开始运行。Mahdavi表示他们对软件工程的理解很独特——不仅因为他们使用Erlang作为开发语言,电脑操作系统用的是FreeBSD(一种可免费使用的UNIX操作系统),还因为他们努力简化公司的运行。
“这种方法在创建大规模基础架构中十分另类,”他在周一的大会上说道,“绝对让人大开眼界,这种解决方式……当问题需要解决便迅速解决掉(显得十分有效)。”
并行代码
在使用Erlang的过程中,WhatsApp也或多或少地推动了并发程序设计语言的发展,所谓并发性,指的是多个进程同时运行。随着网络服务被越来越多的人使用,需要同时处理来自这些人的请求——这种擅长处理并发控制的程序设计语言受到了越来越多的关注。
Facebook在设计新的反垃圾信息系统中——即在社交网络中识别恶意程序或者不需要信息的一个系统——使用了另一种不常见的程序语言叫Haskell。
Haskell出现于上世纪80年代末,最初只是作为一个学术实验而已,因而Haskell很少被使用。但是它却完美地解决了Facebook的反垃圾信息问题,因为Haskell在处理并发任务上有着极为出色的表现,同时还可以让程序员迅速处理紧急问题。
无独有偶,Google和Mozilla(火狐浏览器的开发商)也在寻求这种类似的最佳程序设计语言,这又是一个鲜有听闻的新语言——叫Go and Rust。
与Haskell一样,Erlang同样出现于上世纪80年代,诞生于一家为通讯公司生产硬件和软件的瑞典跨国公司爱立信(Ericsson)。爱立信的工程师为了提高电话网络的交流速度开发出了这款程序设计语言。
“他们不是先创造出一个程序语言然后想它可以干嘛,他们是为了解决一个特定的问题而创造了专门的程序语言。”英国的一位Erlang专家Francesco Cesarini说道。“当时的问题在于大规模的可扩展性和稳定性,而电话网络又是当时唯一具备这些属性的系统。”
到如今,Erlang仍游走于现代程序语言世界的边缘,但是WhatsApp和其他网络公司,比如微信和Whisper,赋予了Erlang新的归宿:新的即时通讯应用。实际上这和过去大规模的电话网络十分相似。说到底,WhatsApp就是手机短信服务的一个崭新替代,当然也会需要“可扩展性和稳定性”。
其次,Erlang保证了程序员可以高速地写代码,而这是当今软件发展中另一至关重要的部分。Erlang可以让程序员迅速插入一段新的代码到程序中,就算程序仍在运行也没有任何关系。在如今这个变化不断的时代,能保持最快速地更新尤为重要。
保持简单,保持智慧
但是这个语言也有自身的弱点。首先很少有程序员知道Erlang,而且Erlang和今日大多数网络公司创建的程序语言几乎没有任何共同点。Facebook一开始用Erlang编写了Facebook Chat这个应用,但是最终不得不重新编写整个应用脚本只为了更好地适应公司其他的基础架构。
“Erlang好比一座孤岛,然而你又没有足够的船可以把陆地和这座孤岛联系起来,”Facebook的工程副总裁Jay Parikh说道。
当然,WhatsApp不需要像Facebook Chat那样与已经存在的基础架构结为一体。而且Mahdavi认为熟悉Erlang的程序员稀缺也不是个问题。
“我们招聘工程师的目标是那些最优秀、最聪明的工程师,我们不会因为谁懂Erlang就聘用他,”Mahdavi说,“我们希望我们的工程师加入我们之后先花一周的时间了解Erlang,熟悉这个语言的使用环境。如果你招聘的是聪明人,他们完全可以胜任这些工作。”
Mahdavi说的没错。公司依靠这些优秀适应性强的工程师获得了成功——当然成功的因素不止这一个。继续问公司成功的秘诀,Mahdavi的回答似乎太过简单。但是简单就是成功的关键:“最最重要的一件道理,就是全身心投入到你要做的那件事上,”他的原话,“其他的事情,其他的技术,乃至办公室的琐事比如开会等等,放到一边抽时间去处理。”
事实上,在WhatsApp工作,员工几乎从来不用开会。虽然确实有一些会议,但也是不得不开的关键会议。
Why WhatsApp Only Needs 50 Engineers for Its 900M Users
EARLIER THIS MONTH, in a post to his Facebook page, WhatsApp CEO Jan Koum announced that his company’s instant messaging service is now used by more than 900 million people. And then Facebook CEO Mark Zuckerberg promptly responded with two posts of his own. One said “congrats,” and the other included a cheeky photo Zuckerberg had taken of Koum as the WhatsApp CEO keyed his 900-million-user post into a smartphone. “Here’s an action shot of you writing this update,” Zuckerberg wrote.
WhatsApp is owned by Facebook, after Zuckerberg and company paid $19 billion for the startup a little more than a year ago. That means Facebook now runs three of the most popular apps on the internet. Its primary social networking service is used by more than 1.5 billion people worldwide, and Facebook Messenger, an instant messaging service spun off from Facebook proper, spans 700 million. But the 900 million-user milestone announced by Koun is very much a WhatsApp achievement, not a product of the formidable Facebook machine.
WhatsApp shows the way forward to a world where internet services can serve a massive audience with help from few people.
One of the (many) intriguing parts of the WhatsApp story is that it has achieved such enormous scale with such a tiny team. When the company was acquired by Facebook, it had 35 engineers and reached more than 450 million users. Today, it employs only about 50 engineers, though the number of WhatsApp users has doubled, and this tiny engineering staff continues to run things almost entirely on its own. In a world where so many internet services are rapidly expanding to millions upon millions of users, WhatsApp shows the way forward—at least in part.
WhatsApp doesn’t talk much about its engineering work—or any other part of its operation, for that matter—but yesterday, at an event in San Jose, California, WhatsApp software engineer Jamshid Mahdavi took the stage to briefly discuss the company’s rather unusual methods. Part of the trick is that the company builds its service using a programming language called Erlang. Though not all that popular across the wider coding community, Erlang is particularly well suited to juggling communications from a huge number of users, and it lets engineers deploy new code on the fly. But Mahdavi says that the trick is as much about attitude as technology.
Mahdavi joined WhatsApp about two years ago, after the startup was up and running, and its approach to engineering was unlike any he had seen—in part because it used Erlang and a computer operating system called FreeBSD, but also because it strove to keep its operation so simple. “It was a completely different way of building a high-scale infrastructure,” he said on Monday. “It was an eye-opener to see the minimalistic approach to solving … just the problems that needed to be solved.”
Code in Parallel
In using Erlang, WhatsApp is part of a larger push towards programming languages that are designed for concurrency, where many processes run at the same time. As internet services reach more people—and juggle more tasks from all those people—such languages become more attractive. Naturally.
With its new anti-spam system—a system for identifying malicious and otherwise unwanted messages on its social network—Facebook uses a language called Haskell. Haskell began as a kind of academic experiment in the late ’80s, and it’s still not used all that often. But it’s ideal for Facebook’s spam fighting because it’s so good at juggling parallel tasks—and because it lets coders tackle urgent tasks so quickly. Meanwhile, Google and Mozilla, maker of the Firefox browser, are striving for a similar sweet spot with new languages called Go and Rust.
In essence, WhatsApp is a replacement for telecoms' texting services.
Like Haskell, Erlang is a product of the ’80s. Engineers at Ericsson, the Swedish multinational that builds hardware and software for telecom companies, developed the language for use with high-speed phone networks. “Instead of inventing a language and then figuring out what to do with it, they set out to invent a language which solved a very specific problem,” says Francesco Cesarini, an Erlang guru based in the UK. “The problem was that of massive scalability and reliability. Phone networks were the only systems at the time who had to display those properties.”
Erlang remains on the fringes of the modern coding world, but at WhatsApp and other internet companies, including WeChat and Whisper, it has found a home with new applications that operate not unlike a massive phone network. In essence, WhatsApp is a replacement for cellphone texting services. It too requires that “scalability and reliability.”
What’s more, Erlang lets coders work at high speed—another essential part of modern software development. It offers a way of deploying new code to an application even as the application continues to run. In an age of constant change, this is more useful than ever.
Keep It Simple, Smarty
The language does have its drawbacks. Relatively few coders know Erlang, and it doesn’t necessarily dovetail with a lot of the code already built by today’s internet companies. Facebook built its original Facebook Chat app in Erlang but eventually rebuilt so that it would better fit with the rest of its infrastructure. “You had this little island that was Erlang, and it was hard to build enough boats back to the island to make everything hook in,” says Facebook vice president of engineering Jay Parikh.
Of course, WhatsApp didn’t have to integrate with an existing infrastructure in this way. And Mahdavi believes the relative scarcity of Erlang coders isn’t a problem. “Our strategy around recruiting is to find the best and brightest engineers. We don’t bring them in specifically because the engineer knows Erlang,” Mahdavi said on Monday. “We expect the engineer to come in and spend their first week getting familiar with the language and learning to use the environment. If you hire smart people, they’ll be able to do that.”
The company has succeeded by hiring engineers who are adaptable—in more ways than one. Asked to explain the company’s secret, Mahdavi’s response seems far too simple. But that’s the point. “The number-one lesson is just be very focused on what you need to do,” he said. “Doing spend time getting distracted by other activities, other technologies, even things in the office, like meetings.”
At WhatsApp, employees almost never attend a meeting. Yes, there are only a few dozen of them. But that too is the point.
Source:Wired
编译:小白