Almost everybody includes a Facebook account, even individuals who do not know the web. With millions people positively using Facebook, upgrading their status, responding to messages, uploading photos and so forth, how's Facebook's page still loading extremely fast?

The trainer told us Facebook was built only using PHP and MySQL, just how can Facebook's performance be so great?

There is no single reason, but a great deal of reasons:

  1. Heavy using caching (APC and memcached), which drastically cuts processing time. Slide 12 compares load time with APC (~130 ms) versus without them - 4050 ms. That's 30x faster!

  2. Using HipHop, which converts PHP into C++ code (that is then put together into a lot more efficient machine code than actual PHP).

  3. Facebook uses PHP and MySQL, but that is not the only factor they will use. For instance, they will use Erlang for his or her chat, Hadoop groupings for a few of their storage. Should you go visit their careers page, you will see they're employing designers with experience of C++, Java, Python, yet others.

  4. Facebook has data distributed across many, many servers. In June 2010, Facebook had 60,000 servers. (think that's an excessive amount of? Google had 500, 000... five years ago)

  5. Facebook transmits very little traffic as you possibly can: they will use static CDNs to provide static content. Gzip to compress data. Snacks, Javascript, HTML - things are reduce to lessen the amount of bytes sent within the network. They will use a technology they call "BigPipe", which transmits partial content as opposed to the whole page.

to say a couple of...

Ultimate reason:

They're saying 98% of all things the thing is on Facebook comes from their massive memcache server cluster.

Take a look at

They've some good videos explaining a lot of their various optimizations. For example, there is a talk on memcached (which will help accelerate common key will get) as well as their front-finish optimizations (doing lazy loading of Javascript, etc).

The astonishing part is when large things are at facebook. With countless customers and 1000's of servers, a apparently small optimisation can finish up saving them huge amount of money or gb of memory.


  • Caching
  • Getting many servers
  • Getting many wise people focusing on which makes it fast.

Facebook wasn't only using MySql - it began out using Cassandra, and it is moving to HBase. Programs like Facebook require a highly scalable Database.

This short article discusses intricacies of Facebook:

There is a put together version of php, actually. My prediction would need to be: insane levels of crazy hardware, extremely efficient code, along with a database structure enhanced with caching, denormalization, clustering...

Simply because they have lots of money. Employing wise designers and purchasing a lot of servers each week is very pricey.