Home php教程 php手册 [总结] 【架构与优化】从Facebook中集思广益,相互学习

[总结] 【架构与优化】从Facebook中集思广益,相互学习

Jun 13, 2016 am 09:42 AM
facebook and optimization study Summarize Architecture this question

本人才学疏浅,提出这个问题只是为了抛砖引玉,希望大家能在自己擅长的领域里对Facebook中可能采用的某个技术或者架构方案或优化方法,做个自己的论述。根据2008年9月1日,腾讯网对Facebook的技术运营副总裁Jonathan Heiliger的访问,我们了解到:
(1)Facebook自称全球流量第四的网站,每天9000万活跃用户访问Facebook的1万台服务器。
(2)25TB数据(08年12月为28TB),40万名外部开发者支持,开发了2.5万套应用软件。
(3)使用LAMP(Linux、 Apache MySQL、 PHP)技术构架;数据库使用MySQL;使用Memcached缓存SQL加速(全球最大的分布式Memcached缓存,800多台服务器,光缓存在Memcached中数据就达20多TB);使用APC进行opcode编译缓存。关于PHP的编译执行如下图所示:

而Facebook的缓存方案如下图所示:


(4)一些后台应用是用Python、Perl和Java,以及一些gcc和Boost。

(5)使用SVN和Git来进行代码管理,并且全部企业内部的软件部署都采用开源程序。


2. 可能会采用的MySQL架构与优化
(1)数据的垂直(无关联数据放置不同数据库服务器)与水平分割(库表散列,如用user_id散列),然后用MySQL Proxy/Spock Proxy进行分割表的反向代理。
(2)合理使用变量,并在本地文件建立散列的映射关系,进一步进行分割。
(3)Master/Slave集群架构,实现读写分离。
(4)合理的数据库结构设计,与索引优化

(5)其他:索引缓存、联合索引、查询缓存等。


3. 可能会采用的系统优化
(1)使用epoll模型
(2)异步I/O
(3)fastcgi或其他方法实现多进程
(4)sendfile系统调用增大网络I/O流量
4. 可能会采用的Web架构或前端技术
(1)Web组件分离,如独立的图片服务器,JavaScript、CSS文件、动态脚本的分离。
(2)Nginx反向代理(或Squid)
(3)多副本负载均衡
(4)HTTP持久连接与合理利用浏览器缓存,例如背景图偏移量技术,及对CSS、JavaScript和视频的
5. 一些可能会用也可能不用的压力测试
(1)Apache的ab进行压力测试
(2)Apache的prefork模式进行多进程切换的压力测试
(3)使用Nginx为多进程下的CPU与IO进行监控

Linux下的Memcached开发,请参看逆雪寒的文章http://bbs.phpchina.com/viewthread.php?tid=48667&highlight=linux%2B%CF%C2%B5%C4%2Bmemcached%2B%BF%AA%B7%A2
Memcached的分布式缓存机制及相关解决方案请阅读以下网址及相关文章:
http://tech.idv2.com/2008/07/24/memcached-004/
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the architecture and working principle of Spring Data JPA? What is the architecture and working principle of Spring Data JPA? Apr 17, 2024 pm 02:48 PM

SpringDataJPA is based on the JPA architecture and interacts with the database through mapping, ORM and transaction management. Its repository provides CRUD operations, and derived queries simplify database access. Additionally, it uses lazy loading to only retrieve data when necessary, thus improving performance.

How steep is the learning curve of golang framework architecture? How steep is the learning curve of golang framework architecture? Jun 05, 2024 pm 06:59 PM

The learning curve of the Go framework architecture depends on familiarity with the Go language and back-end development and the complexity of the chosen framework: a good understanding of the basics of the Go language. It helps to have backend development experience. Frameworks that differ in complexity lead to differences in learning curves.

C++ program optimization: time complexity reduction techniques C++ program optimization: time complexity reduction techniques Jun 01, 2024 am 11:19 AM

Time complexity measures the execution time of an algorithm relative to the size of the input. Tips for reducing the time complexity of C++ programs include: choosing appropriate containers (such as vector, list) to optimize data storage and management. Utilize efficient algorithms such as quick sort to reduce computation time. Eliminate multiple operations to reduce double counting. Use conditional branches to avoid unnecessary calculations. Optimize linear search by using faster algorithms such as binary search.

Learn the main function in Go language from scratch Learn the main function in Go language from scratch Mar 27, 2024 pm 05:03 PM

Title: Learn the main function in Go language from scratch. As a simple and efficient programming language, Go language is favored by developers. In the Go language, the main function is an entry function, and every Go program must contain the main function as the entry point of the program. This article will introduce how to learn the main function in Go language from scratch and provide specific code examples. 1. First, we need to install the Go language development environment. You can go to the official website (https://golang.org

Hand-tearing Llama3 layer 1: Implementing llama3 from scratch Hand-tearing Llama3 layer 1: Implementing llama3 from scratch Jun 01, 2024 pm 05:45 PM

1. Architecture of Llama3 In this series of articles, we implement llama3 from scratch. The overall architecture of Llama3: Picture the model parameters of Llama3: Let's take a look at the actual values ​​of these parameters in the Llama3 model. Picture [1] Context window (context-window) When instantiating the LlaMa class, the variable max_seq_len defines context-window. There are other parameters in the class, but this parameter is most directly related to the transformer model. The max_seq_len here is 8K. Picture [2] Vocabulary-size and AttentionL

Review! Comprehensively summarize the important role of basic models in promoting autonomous driving Review! Comprehensively summarize the important role of basic models in promoting autonomous driving Jun 11, 2024 pm 05:29 PM

Written above & the author’s personal understanding: Recently, with the development and breakthroughs of deep learning technology, large-scale foundation models (Foundation Models) have achieved significant results in the fields of natural language processing and computer vision. The application of basic models in autonomous driving also has great development prospects, which can improve the understanding and reasoning of scenarios. Through pre-training on rich language and visual data, the basic model can understand and interpret various elements in autonomous driving scenarios and perform reasoning, providing language and action commands for driving decision-making and planning. The base model can be data augmented with an understanding of the driving scenario to provide those rare feasible features in long-tail distributions that are unlikely to be encountered during routine driving and data collection.

How to optimize the startup items of WIN7 system How to optimize the startup items of WIN7 system Mar 26, 2024 pm 06:20 PM

1. Press the key combination (win key + R) on the desktop to open the run window, then enter [regedit] and press Enter to confirm. 2. After opening the Registry Editor, we click to expand [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorer], and then see if there is a Serialize item in the directory. If not, we can right-click Explorer, create a new item, and name it Serialize. 3. Then click Serialize, then right-click the blank space in the right pane, create a new DWORD (32) bit value, and name it Star

Vivox100s parameter configuration revealed: How to optimize processor performance? Vivox100s parameter configuration revealed: How to optimize processor performance? Mar 24, 2024 am 10:27 AM

Vivox100s parameter configuration revealed: How to optimize processor performance? In today's era of rapid technological development, smartphones have become an indispensable part of our daily lives. As an important part of a smartphone, the performance optimization of the processor is directly related to the user experience of the mobile phone. As a high-profile smartphone, Vivox100s's parameter configuration has attracted much attention, especially the optimization of processor performance has attracted much attention from users. As the "brain" of the mobile phone, the processor directly affects the running speed of the mobile phone.

See all articles