* What database does Facebook
use is one of the most common questions asked when folks start taking
about what database is the most scalable for large scale web
applications. In fact, it is usually a person who is an open source
proponent, and knows very well that Facebook uses MySQL
as their core database engine. Because of this fact, this is often the
single biggest reason that developers use to push to get MySQL used in
their company. I would imagine that is why it is a very popular Google
query.
* While Facebook uses MySQL, they do not use it as-is out of the box. In fact, their team has submitted numerous high-performance enhancements to the MySQL core and Innodb plug-in. Their main focus has been on adding performance counters to Innodb. Other changes focused on the IO sub-system, including the following new features :
* Facebook primarily uses MySQL for structured data storage such as wall posts, user information, etc. This data is replicated between their various data centers. For blob storage (photos, video, etc.), Facebook makes use of a custom solution that involves a CDN externally and NFS internally.
* It is also important to note that Facebook makes heavy use of Memcache, a memory caching system that is used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce reading time. Memcache is Facebook’s primary form of caching and greatly reduces the database load. Having a caching system allows Facebook to be as fast as it is at recalling your data. If it doesn’t have to go to the database it will just fetch your data from the cache based on your user ID.
* So, while “What database does Facebook use?” seems like a simple question, you can see that they have added a variety of other systems to make it truly web scalable. But, still feel free to use the argument, “MySQL is as good or better than Oracle or MS SQL Server, heck, even Facebook uses it, and they have 1200 Million users!”.
* While Facebook uses MySQL, they do not use it as-is out of the box. In fact, their team has submitted numerous high-performance enhancements to the MySQL core and Innodb plug-in. Their main focus has been on adding performance counters to Innodb. Other changes focused on the IO sub-system, including the following new features :
- innodb_io_capacity – sets the IO capacity of the server to determine rate limits for background IO
- innodb_read_io_threads, innodb_write_io_threads – set the number of background IO threads
- innodb_max_merged_io – sets the maximum number of adjacent IO requests that may be merged into a large IO request
* Facebook primarily uses MySQL for structured data storage such as wall posts, user information, etc. This data is replicated between their various data centers. For blob storage (photos, video, etc.), Facebook makes use of a custom solution that involves a CDN externally and NFS internally.
* It is also important to note that Facebook makes heavy use of Memcache, a memory caching system that is used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce reading time. Memcache is Facebook’s primary form of caching and greatly reduces the database load. Having a caching system allows Facebook to be as fast as it is at recalling your data. If it doesn’t have to go to the database it will just fetch your data from the cache based on your user ID.
* So, while “What database does Facebook use?” seems like a simple question, you can see that they have added a variety of other systems to make it truly web scalable. But, still feel free to use the argument, “MySQL is as good or better than Oracle or MS SQL Server, heck, even Facebook uses it, and they have 1200 Million users!”.
0 comments:
Post a Comment