Pages

Sunday 26 February 2012

Apache Cassandra and Tornado -Rocking Facebook infrastructure

Here is a post about two rock-solid technologies of Facebook which are highly responsible for all the real-time activities.Rather then keeping the suspense within,here's the technologies:

Apache Cassandra

Apache is a well-known name in server domain for its rock-solid reliability and fully-customizable structure.Most of the large companies have a Apache web server by default.

But this variant of Apache,named Apache Cassandra is killer one.It is designed so that its main purpose is what real-time web apps and websites wants : stability and quick response.When you need scalability and high availability without compromising performance,this is the best choice. Cassandra's support for replicating across multiple servers(or group of servers) is best-in-class, providing lower latency for users of website (or apps) and the peace of mind of knowing that the user can survive regional outage,with no single point of failure .

It has a special  ColoumnFamily data model,which offers

    1. To save data as column indexes
    2. Log-style updates of data changed in server
    3. Rapid and strong built-in caching
    4. Strong support for materialized(less use of SQL) views(view means an editable-copy of table in database)
.

Tornado

Using a blocking socket, execution will wait (i.e. "block") until the full socket operation has taken place. So, you can process any results/responses in your code immediately after. These are also called synchronous sockets.

A non-blocking socket operation will allow execution to resume immediately and you can handle the server's response with a callback or event. These are called asynchronous sockets.

Why I am explaining this would be clear after reading below.

Tornado is a relatively simple, non-blocking web server framework written in Python. It is designed to handle thousands of simultaneous connections, making it ideal for real-time Web services.

The framework is distinct from most mainstream web server frameworks (and most Python frameworks) because it is non-blocking and very fast. Because it is non-blocking, it can handle thousands of simultaneous real-time connections, which means it is ideal for real-time web services like Facebook.It was mainly created to serve Friend Feed,which is another social sharing service which allows people know what their friends are finding on internet.By the way,Facebook has acquired Friend Feed in 2009.

Thereby Tornado is one of the main web server in Facebook's infrastructure.

Thursday 23 February 2012

Facebook Javascript and Scribe - Technologies in Facebook

Being  enthused by my previous blog post,I have started researching and found out the unknown (or otherwise not understandable)  technologies used by Facebook.

Here is a glimpse of some of them :

Facebook Animation (Facebook JavaScript)

It is a customizable library of JavaScript (also called FaceBookJavaScript) which gives developers an easy way to improve their user interface with a line of code or two. All animations are CSS based, so a working knowledge of CSS will really help you out here. It is mostly used to create custom animations using  CSS and DOM changes and additions.

While FBJavaScript's Animation library delivers much of the same functionality as other animation libraries, the interface is much different. It's a great improvement over current libraries. Understanding the code doesn't require complex dictionaries of properties, but instead relies on intuitive method chaining.


Scribe

Scribe is a server for aggregating log data streamed in real time from a large number of servers. It is designed to be scalable, extensible without client-side modification, and robust to failure of the network or any specific machine.

In short,it takes your data which is divided into various servers into a single page.
For example,when you log-in and see your profile,all the data is not always (or rather never) stored on  a single server. Scribe gets data from all the servers,aggregates it and shows on the client side just as if it is from single server.This shows its great speed and robustness.

It is now used extensively for ticker in Facebook.



Other technologies in successive posts.....

Sunday 19 February 2012

Tools and Technologies that Facebook Use

Rather then going at a Road Runner speed,I thought it would be better to give off the some of the technical tools and technologies that Facebook uses.

This might be important as it may aware you the per-requisites that you would require to understand the Making of Facebook.

Facebook uses a variety of services, tools, and programming languages to make up its core infrastructure. At the front end, their servers run a LAMP (Linux, Apache, MySQL, and PHP) stack with Memcache.Let’s take a look at exactly what that means.

Following is the most basic technologies that Facebook uses:

Linux & Apache

This part is pretty self-explanatory. Linux is a Unix-like computer operating system kernel. It’s open source, very customizable, and good for security.

Facebook runs the Linux operating system on Apache HTTP Servers. Apache is also free and is the most popular open source web server in use.

MySQL

For the database, Facebook utilizes MySQL because of its speed 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 good web programming language with extensive support and an active developer community and it is good for rapid iteration.PHP is a dynamically typed/interpreted scripting language.

Memcache

Memcache is a memory caching system that is used to speed up dynamic database-driven 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.


 These are the most basic technologies used by Facebook technologies,if you want the detailed or exhaustive list of technologies (obviously with understandable description by me) ,tell in the comments section.

Wednesday 15 February 2012

Facebook Homepage to Graph API

Recently while log-in at facebook,I saw a different picture than other times,as follows:


As pointed above,the part is added is latest thing.Then being curious I went into it and found out data use policy and a lot of interesting tools,as shown below:


 It shows "how they use your data" and blah-blah-blah.But the most interesting feature was "InteractiveTools"  inside More Resources .Clicking it shows the following photo:




After looking at all the tools,I found the last one:"Graph API",the most important and most useful.But whats under it.....???There are two ways to do it:

1.  Obviously by doing all the things I did,and thereby trying to open "Graph API"
2.  To read my next blog post  about facebook.

Concept behind Facebook



Facebook divides the social design into three parts:

      Community , Conversation , Identity


In simple words,it can be explained as follows:



1.Identity : It means ourselves and how are we represented against others

2.Conversation : It explains how we are communicating with others

3.Community : It refers to people we know and trust




 

 How is Facebook built?

Facebook is built with idea that rather than giving a recipe to eat,let them make it.Means let people make their own community,rather than giving them a ready made community.

Here ends the most boring,but the most important part of Making of Facebook.Now we will understand how does it uses(or exploits....;)...) our data for the purpose.