Social networking is the art of connecting with those who share common interests. Your network is a community that helps keep you united with others and offers many benefits. Networking via social media sites has revolutionized how we use the Internet and is at the forefront of what we now call Web 2.0.
Now we discuss Facebook’s inner workings,covering its architecture and fronten,backend infrastructure that hold Facebook together.
How does Faceboook works ?
The Front End:
Facebook uses a variety of services, tools, and programming languages to make up its core infrastructure. At the front end, their servers run a Linux, Apache, MySQL, and PHP stack with Memcache.Let’s take a look at exactly what that means.
Apache and linux:
This allotment is appealing self-explanatory. Linux is a Unix-like computer operating arrangement kernel. It’s accessible source, actual customizable, and acceptable for security. Facebook runs the Linux operating arrangement on Apache HTTP Servers. Apache is additionally chargeless and is the best accepted accessible antecedent web server in use.
MYSQL:
For the database, Facebook utilizes MySQL because of its acceleration and reliability. MySQL is used primarily as a key-value store as data is randomly distributed amongst a large set of logical instances. These logical instances are spread out across physical nodes and load balancing is done at the physical node level.
As far as customizations are concerned, Facebook has developed a custom partitioning scheme in which a global ID is assigned to all data. They also have a custom archiving scheme that is based on how frequent and recent data is on a per-user basis. Most data is distributed randomly.
Php:
Facebook uses PHP because it is a acceptable web programming accent with all-encompassing abutment and an alive developer association and it is acceptable for accelerated iteration. PHP is a dynamically typed/interpreted scripting language.
Memcache is a memory caching system that is used to speed up dynamic databasedriven websites (like Facebook) by caching data and objects in RAM to reduce reading time. Memcache is Facebook’s primary form of caching and helps alleviate 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.
Memchache simply means the Free and open source,high-performance,distributed memory object catching system,generic in nature.but intended for use in speeding up web apps by alleviating database load.
Downsides to Using LAMP:
LAMP is the abbreviation for Linux,Apache,Mysql,Php. Facebook has realized that there are downsides to using the LAMP stack. Notably, PHP is not necessarily optimized for large websites and therefore hard to scale. Also, it is not the fastest executing language and the extension framework is difficult to use.
Mike Schroepfer , Facebook’s Vice President of Engineering, recently did an interview at EmTech@MIT concerning this. “Scaling any website is a challenge,” Schroepfer said, “but scaling a social network has unique challenges.”
He went on to say that unlike other websites, you can’t just add more servers to solve the problem because of Facebook’s “huge interconnected dataset.” New connections are created all the time due to user activity.
Facebook has grown so quickly that they are often faced with issues regarding database queries, caching, and storage of data. Their database is huge and largely complex . To account for this, Facebook has started a lot of open source projects and backend services.
The Back End:
Facebook’s backend services are written in a variety of different programming languages including C++, Java, Python, and Erlang. Their philosophy for the services creation is as follows:
1. Create a service if needed
2. Create a toolset /framework for easier creation of services
3. Use the right programming language for the task
I will discuss a few of the essential tools that Facebook has developed.
Thrift (protocol):
Thrift is a lightweight remote procedure call framework for scalable cross-language services development. Thrift supports C++, PHP, Python, Perl, Java, Ruby, Erlang, and others. It’s quick, saves development time, and provides a division of labor of work on high-performance servers and applications.
Scribe (log server):
Scribe is a server for aggregating log data streamed in real-time from many other servers. It is a scalable framework useful for logging a wide array of data. It is built on top of Thrift.
Cassandra (database):
A highly scalable.eventually consistent.distributed,structured key value store.
Cassandra is a database management system designed to handle large amounts of data spread out across many servers. It powers Facebook’s Inbox Search feature and provides a structured key-value store with eventual consistency.
HipHop for PHP:
HipHop for PHP is a source code transformer for PHP script code and was created to save server resources. HipHop transforms PHP source code into optimized C++. After doing this, it uses g++ to compile it to machine code.
0 comments:
Post a Comment