Facebook's PHP performance and scalability ()

Source: Internet
Author: User
Tags apc

The popular Facebook is developed with PHP. With some technical exchanges, we will gradually see the experiences shared by Facebook technicians. Recently, this geeksessions site has seen the documents shared by Facebook's Lucas nealan for reference.

Cache is king

Any successful website has a set of best-suited cache policies.

Note: This hierarchical picture is not strictly top-down.

The alternative "> PHPCache, APC

On average, every Facebook user accesses more than 50 pages a day, so it is important to optimize the loading time of PHP pages. On the "> PHP cache layer, Facebook uses APC.

Lucas nealan's "> In the PPT, for example, the time displayed on a page is reduced from over 4000 milliseconds to over 100 milliseconds. In APC. Stat disabled mode, the performance is better. However, you need to restart or use apc_cache_clear () to notify you of updates.

Memcached Layer

APC cache contains non-user-related information, and user-related data cache is of course in memcached.

Facebook has deployed more than 400 memcached servers, and more than 5 TB of data is stored in memcached. This is the world's largest memcached cluster. Also contributed a lot to memcachedCode, Including UDP support and performance improvement (performance improvement over 20% ).

Program Profiling

Facebook developers use callgrind, APD, xdebug, kcachegrind and other tools to perform benchmark performance tests. Any web project is indispensable and easy to ignore. All developers should be skilled in using these tools.

Supplement: language selection

Why does Facebook choose "> PHP instead of other languages? The phrase Cal Henderson of Flickr shows: "ages's don't scale, architecture scale ".

According to the 80-20 principle, APC and memcached are the most important. In these two stages, the cost/benefit ratio is greater than that in other stages.

(The figure above is taken from the documents of Lucas nealan and the copyright belongs to him)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.