Wednesday, March 7, 2012


Facebook Vs Google From A Developer's Perspective

Facebook and Google are the two giants of the internet.
They evolved with different ideas, but have lot of things in common.

Type and services

Facebook: Social Network.
     Other services: provides its social graph  to third party apps.
  
Google:  Search Engine.
     Other services:  google+, blogger, google docs, google maps etc.

Technology Behind

Facebook

Language

  • PHP: Front end is written in PHP. Facebook made Hip-Hop to accelerate PHP pages.
  •  C,C++ and Java:  Most of the core tasks (back-end) are written in these languages.
  • Er lang and Python: Facebook Chat is build in Erlang and many of the glue code is written in python.
         The  different back-end and front-end services uses  Apache Thrift to communicate.
Thrift was developed by Facebook developers team, which was made public and now it comes under one of the Apache projects.

Database
         MySQL & Cassandra: Mysql is highly modified by them so that it can be scaled and  Cassandra was developed by them  to make the system more scalable.Facebook uses an Open source implementation of Map-Reduce called Hadoop.

Client Side
           Facebook  has a very good interface and it provides real time notification and alerts as well as a good Chat application.
     This user interface is  probably  because of :
  • Its own customized Javascript Library
  • User interface framework developed of CSS , Javascript and standard DOM scripting
  • It uses a lot of AJAX
  • JSON is  used to send and get data from the server side during AJAX calls.
Handling the Traffic
       With  millions of users online, it is obviously hard to manage the traffic.
       Some of the techniques used by them are:
  • Memcached for caching.
  • Content Delivery Network for Static and Dynamic Components.
  • Hip-Hop to speed up PHP pages.
  • Load Balancing Geographically.
Facebook  architecture was made to scale horizontally from the beginning. It was a very smart move by the founder.

Google

Language
        Python/JAVA: for small tasks and  coding front-end.
        C/C++/JAVA: for writing most core algorithms and programs that together complete the search engine.
        It uses lots of other languages too, Some of them are developed by their own.
Database and Storage
        To handle these requirements google uses  Big Table,  Google File SystemMap Reduce.
Client Side
         Google apps also uses lot of AJAX, and uses JSON too like facebook.
         Google also  uses Jquery ( a  popular javascript framework).
         The below url is one of the Javascript files that decides the CSS properties of elements.
Handling the Traffic
        Google is an internet giant.  Its has many servers scaled horizontally lying across many geographical reasons.
       Techniques used
  • Content Delivery Networks.
  • Server Load Balancing.
  • Compression techniques.
  • Horizontal Scaling.
        

Some Useful information

              The above discussion is not fully complete, as most of  core things of the companies are not made public.However, this information is very useful.

The system architecture:
        For handling huge amount  of traffic, both are  configured to scale horizontally. Thereby, growing according to need.Besides,   configuration and optimization of   Operating System and  the inter-networking of the system components also contribute to efficiency of such system.
Hence a good understanding of operating systems, TCP/IP protocols and networking is required.

Handling Huge Data sets.
           To handle huge data and store them,   Cassandra, Map-reduce, Google File system  etc. evolved.  All were made to scale horizontally.
They are all developed on the fundamental principles of database.
Their purpose was to make the data more available and reduce failure and data loss.
Hence, in this area a good knowledge of Database, different technologies and their implementation is required.

Programming
             The choice of language  matters with purpose.
e.g. PHP, Python, Erlang, Ruby are used for small purposes and C/C++/JAVA are used for Core tasks.
The  system uses some  protocol  to communicate between different  applications like 
Thrift,  HTTP,  Rest , SOAP.

User Interface
          Google and Facebook  is  alive just because of its users.  So, they always keep  making the interface more easy and clean.
Heavy use of AJAX makes the applications more dynamic.
Javascript, CSS  is used to design and control the user interface.
To make things easier,  frameworks are used.

Some technologies to learn

>> Hadoop / Map - Reduce
>> Cassandra, BigTable ,  MongoDB, Neo4j

>> Linux System Optimization
>> Server Load Balancing
>> Content Delivery Networks

>> HTTP, REST, Thrift ( used for communication)
>> Memcache, Hip-Hop
>> JSON and Ajax, Jquery, Prototype Js, Ext Js



Thank You.@dattu

No comments:

Post a Comment