脸书架构 [英] Facebook Architecture

查看:23
本文介绍了脸书架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找有关 Facebook 架构、挑战和挑战的文章/信息.他们解决问题的方式.他们使用什么&为什么他们使用.它们是如何扩展的?他们做什么的设计决策是什么等等.主要的基础是学习.了解处理如此大量流量的站点为架构师等提供了很多指导,以便在设计新站点时牢记某些内容.我正在分享我的发现.

I have been scrounging for articles/info about the architecture at Facebook, the challenges & ways they tackle them. What they use & why they use. How do they scale & what are the design decisions for what they do etc. Main underpinning being to learn. Knowing about sites which handles such massive traffic gives lots of pointers for architects etc. to keep in mind certain stuff while designing new sites. I am sharing what I found.

  1. Facebook Science &社交图谱(视频)
  2. Facebook 的规模
  3. Facebook 聊天架构
  4. Facebook 博客
  5. Facebook Cassandra 架构和设计
  6. Facebook 工程说明
  7. Quora - Facebook 架构
  8. 6 亿用户的 Facebook
  9. Hadoop &它在 Facebook 上的使用
  10. Erlang 在 Facebook:聊天架构
  11. Facebook 性能缓存演进
  12. Facebook 连接/登录架构

我还有 2 个链接,但由于本网站的限制无法发布.另外,如果有人有更好的,请分享(不必仅与 Facebook 相关).

I have 2 more links but unable to post due to restrictions at this site. Also, please share if anyone has anything better (need not be related to Facebook only).

P.S.- 我找不到分享这项研究的好地方,因此发起了这项计划.希望这对某人有所帮助.

P.S. - I wasn't able to find good places to share this research, hence this initiative. Hope this helps someone.

推荐答案

Facebook 经历了许多变化,它最初的设计并不是为了提高效率.它旨在完成它的工作.我完全不知道代码是什么样的,你可能找不到太多关于它的信息(出于明显的安全和版权原因),但只要看看 API.看看它更改的频率以及其中有多少无法正常工作、不再正常工作或根本无法正常工作.

Well Facebook has undergone MANY many changes and it wasn't originally designed to be efficient. It was designed to do it's job. I have absolutely no idea what the code looks like and you probably won't find much info about it (for obvious security and copyright reasons), but just take a look at the API. Look at how often it changes and how much of it doesn't work properly, anymore, or at all.

我认为他们最大的王牌是嘻哈.http://developers.facebook.com/blog/post/358您可以自己使用 HipHop:https://github.com/facebook/hiphop-php/wiki

I think the biggest ace up their sleeve is the Hiphop. http://developers.facebook.com/blog/post/358 You can use HipHop yourself: https://github.com/facebook/hiphop-php/wiki

但如果你问我这是一项非常雄心勃勃且可能会浪费时间的任务.Hiphop 只支持这么多,不能简单地把所有东西都转换成 C++.那么这告诉我们什么呢?好吧,它告诉我们 Facebook 没有充分利用 PHP 语言.它没有使用最新的 5.3,我敢打赌还有很多 PHP 4 兼容.否则,他们无法使用 HipHop.HipHop 是一个好主意,需要成长和扩展,但就目前的情况而言,它对许多正在构建新 PHP 应用程序的人来说并没有真正的用处.

But if you ask me it's a very ambitious and probably time wasting task. Hiphop only supports so much, it can't simply convert everything to C++. So what does this tell us? Well, it tells us that Facebook is NOT fully taking advantage of the PHP language. It's not using the latest 5.3 and I'm willing to bet there's still a lot that is PHP 4 compatible. Otherwise, they couldn't use HipHop. HipHop IS A GOOD IDEA and needs to grow and expand, but in it's current state it's not really useful for that many people who are building NEW PHP apps.

还有通过 Resin/Quercus 之类的东西从 PHP 到 JAVA.同样,它并不支持所有内容...

There's also PHP to JAVA via things like Resin/Quercus. Again, it doesn't support everything...

另一件需要注意的事情是,如果您使用任何非标准的 PHP 模块,您也无法将该代码转换为 C++ 或 Java.但是...让我们来看看 PHP 模块.它们是用 C++ 编译的.因此,如果您可以构建执行某些操作(例如解析 XML 等)的 PHP 模块,那么您基本上(减去一些交互)以相同的速度工作.当然,您不能只为所有可能的需求和整个应用程序制作一个 PHP 模块,因为您必须重新编译,并且编写代码等会更加困难.

Another thing to note is that if you use any non-standard PHP module, you aren't going to be able to convert that code to C++ or Java either. However...Let's take a look at PHP modules. They are ARE compiled in C++. So if you can build PHP modules that do things (like parse XML, etc.) then you are basically (minus some interaction) working at the same speed. Of course you can't just make a PHP module for every possible need and your entire app because you would have to recompile and it would be much more difficult to code, etc.

然而……有一些方便的 PHP 模块可以帮助解决速度问题.虽然在一天结束时,我们拥有称为云"的这个很棒的东西,有了它,我们可以扩展我们的应用程序(包括 PHP),所以它不再那么重要了.硬件变得越来越便宜.亚马逊刚刚(再次)降低了价格.

However...There are some handy PHP modules that can help with speed concerns. Though at the end of the day, we have this awesome thing known as "the cloud" and with it, we can scale our applications (PHP included) so it doesn't matter as much anymore. Hardware is becoming cheaper and cheaper. Amazon just lowered it's prices (again) speaking of.

因此,只要您围绕需要一天扩展的想法编写 PHP 应用程序……那么我认为您很好,我不确定我什至会查看 Facebook 和他们的内容这样做是因为当他们这样做时,这是一个完全不同的世界,现在正试图支持并维护该基础设施......好吧,你会得到像 HipHop 这样的东西.

So as long as you code your PHP app around the idea that it will need to one day scale...Then I think you're fine and I'm not really sure I'd even look at Facebook and what they did because when they did it, it was a completely different world and now trying to hold up that infrastructure and maintain it...Well, you get things like HipHop.

现在 HipHop 将如何帮助您?不会.它不能.您刚开始,可以使用 PHP 5.3.我强烈建议您研究 PHP 5.3 框架以及 PHP 5.3 带来的所有新优势以及 SPL 库,并考虑您的数据库.您最有可能从数据库提供内容,因此请查看 MongoDB 和其他类型的无模式和面向文档的数据库.对于最常见"类型的网站/应用程序,它们更快更好.

Now how is HipHop going to help you? It won't. It can't. You're starting fresh, you can use PHP 5.3. I'd highly recommend looking into PHP 5.3 frameworks and all the new benefits that PHP 5.3 brings to the table along with the SPL libraries and also think about your database too. You're most likely serving up content from a database, so check out MongoDB and other types of databases that are schema-less and document-oriented. They are much much faster and better for the most "common" type of web site/app.

看看 Foursquare 和 Smugmug 等新公司以及其他一些使用新技术的公司及其使用方式.尽管 Facebook 如此成功,但老实说,我不会看它们如何"构建高效的网站/应用程序.我并不是说他们没有非常(非常)有才华的人在那里工作以创造性地解决(他们的)问题......我也不是说 Facebook 不是一个好主意,它不是成功,你不应该从中获得想法......我只是说,如果你可以查看他们的整个源代码,你可能不会从中受益.

Look at NEW companies like Foursquare and Smugmug and some other companies that are utilizing NEW technology and HOW they are using it. For as successful as Facebook is, I honestly would not look at them for "how" to build an efficient web site/app. I'm not saying they don't have very (very) talented people that work there that are solving (their) problems creatively...I'm also not saying that Facebook isn't a great idea in general and that it's not successful and that you shouldn't get ideas from it....I'm just saying that if you could view their entire source code, you probably wouldn't benefit from it.

这篇关于脸书架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆