Saturday, July 27, 2024

What Technology Stack to choose to compete with Facebook?

Social Media has been one of the biggest buzzwords of the 21st Century. Social media usage has increased manifold in the last decade, currently, we have multiple social media platforms where Millions of users have been connected.

It has generated a lot of traction with the users and it is indeed influencing our lives and phycological wellbeing along with our behavioral patterns.

Social Media is a platform that offers a unique proposition for organizations across the World to approach their potential customers and clients and even use it as a different kind of marketplace.

Though we have multiple famous platforms like Facebook, Twitter, Snapchat, Tumblr, WeChat, WhatsApp, and Instagram, however, Facebook stands out due to its massive following and global acceptance.

Facebook, which was launched on February 4th, 2004 as a simple social media website, has grown into one of the largest digital marketing and communication platform in the World.

It’s not just social media anymore, Facebook is investing fanatically and developing innovative products, it has created its own Libra cryptocurrency, and it is also developing solutions by using artificial intelligence (AI), the Internet of things, and Augmented reality.

Few amazing Statistics about Facebook

  • As of June 30th, 2020, Facebook has 2.70 billion monthly active users, it’s like every 3rd Human being is available on Facebook.
  • More than 1.79 billion users log onto Facebook on daily basis.
  • It has generated a whopping $18,321 Million of Ad Revenues for Q2,2020.
  • Its average revenue Per User is $7.05 for Q2 2020.
  • Facebook is the third-most visited website in the World after Google and YouTube.
  • As per research, approximately 75 & of high-income earners people use Facebook, which makes it a de-facto platform for marketing and advertising.
  • Facebook has more than 10 Million active groups. It gives a wonderful platform to millions of organizations across the World to create a community around their brands and products, and in a way promote their products.

Can we develop a Facebook competitor?

Facebook has established its unique selling proposition and every other organization wants to replicate its Business and Revenue model, but the biggest question is, can we make another Social Media platform that can compete with Facebook?

And If the answer is ‘Yes’, then what Technology stacks are required to create a Social Media behemoth like Facebook?

In this article, we will be covering the Technology Stack used by Facebook, and at the same time, we will be assessing the possibility of creating another massive Social Media platform, which can compete with Facebook and replicate its model. Before going any further, we need to know the Technology Facebook uses to run this massive Social Media platform.

What Technology Stack does Facebook use?

First of all, we have to understand that Facebook is not a normal website, it’s unarguably the biggest social network website on Earth. It has more than 2.7 Billion active users accessing it on monthly basis.

Just imagine the sheer gigantic system of Facebook, which processes 2.5 billion components of content and more than 500 Terabytes of data every 24 hours. It registers more than 2.7 billion User actions and more than 300 million every 24 hours. Technically speaking, it scans more than 200 Terabytes of data every 24 hours.

Primarily Facebook was developed using the LAMP stack which stands for Linux, Apache, MySQL, and PHP, and it is one of the most popular stacks available in the market.

However, with the ever-increasing userbase and features, Facebook had to scale its operation to incorporate all those marker demands and had to develop some custom-made solutions, it also integrated several 3rd Party services and components to modify the approach to existing Technology Architecture.

We have zotted down the details of Technology Stack and other components used in Facebook.

Linux – Facebook has optimized to get the best out of it, especially in terms of Network performance, Security and stability.

PHP – It does use PHP, however as we are aware of PHP’s limitations, hence Facebook had to build a custom compiler for it so that the custom native code could be translated into web servers’ code. These customizations have boosted the code performance and made the code more robust.

MySQL – Facebook uses it only as persistent storage, it has made customized changes and moved logic, joins, and other database-related codes onto the web servers, as that boosts the overall performance.

React.js – It is an open-source JavaScript library developed by Facebook, which helps developers to create the end-user interface and several other interface components. The amazing fact is, that React is unarguably the most used JavaScript library in the World, with a strong and dedicated developer community around it.

Haystack – As we are aware, Facebook captures a gigantic amount of Data, Images, and Videos, hence Facebook has developed this high-performance Image storage and retrieval system which helps Facebook to scale the object store at such a massive scale. Per some conservative estimates, Facebook currently has approximately 100 Billion Pictures.

Memcached – It is one of the most important components of Facebook. It is one of the most popular distributed memory caching solutions, which acts as a caching layer between MySQL servers and Web servers.

Facebook had made umpteen customizations to Memcached, that’s why Facebook is able to process more than a billion requests per second and can store trillions of datastore items.

Facebook operates thousands of Memcached servers, with a combined data store capacity of Petabytes of cached data at any one point in time. Facebook runs the world’s largest Memcached installation and it is miles ahead of any of its competitors.

HipHop and HipHop Virtual Machine

As we mentioned earlier, Facebook uses PHP, though we are also very much aware of PHP’s limitations, it is not a traditional programming language, it is considered a scripting language instead. PHP is very slow when it is being compared with the code that runs at the Web Server’s end.

Facebook understood this problem and they conceived the idea of creating a tool that works as an intermediate between PHP and Web server which converts PHP code into C++ native code, that could be compiled for better performance and efficiency.

This indeed allows Facebook to utilize the capabilities of its web servers, as Facebook is heavily dependent on PHP to serve dynamic content.

HipHop solved the dilemma of Facebook, as it was traditionally using PHP. Facebook discontinued the HipHop project in 2013 and replaced it with a polished version which is known as HipHop Virtual Machine, again a customized product by Facebook.

Hive and Hadoop

Facebook scans and captures a huge amount of data and performs different kinds of analysis on it, which could be used to capture the behavior of End users and could be supplied to the Organizations dependent on Data supplied by Facebook. To cater to the demand at such a massive scale, Facebook uses Hadoop and Hive.

Hadoop is an open-source Apache project, which provides a framework for distributed storage and process calculations on gigantic amounts of data. Facebook uses Hadoop as a primary tool to perform Data Analysis and several other complex Data operations.

Hove is another indigenous product developed by Facebook, which helps process the SQL queries against Hadoop, ultimately enabling data processing quite easy and efficient.

Thrift – The open-source platform for Programming languages

Facebook is such a complex system that offers a wide variety of services, and it is not possible to build all that using a single programming language. Facebook uses PHP to develop its front-end, whereas the Erlang is used for making a unique Chat system. Java and C++ are also used at several junctures.

Facebook understood in the very beginning that a single programming language can’t provide an overall solution, hence it created Thrift, which is a cross-language framework, which binds all the different languages together, and provides them a platform to interact with each other.

This platform helps Facebook to engage a wide variety of developers to create specific components of the Facebook ecosystem.

BigPipe

It is another pathbreaking innovation by Facebook, it is a dynamic web page serving system that offers the web pages in sections for optimal performance. End-User can retrieve various components of Facebook (Newsfeed, Chat window) separately and it helps them to use various Facebook features simultaneously without compromising on performance.

Varnish

It is an open-source HTTP accelerator, which is developed for websites that host dynamic and heavy content. It also works as a load balancer, stores content in the cache, and served them to end-users at blistering fast speed.

Facebook uses Varnish to track billions of end Users’ requests and serve their photos and profile pictures at a lightning-fast speed.

Presto

It is another invention of Facebook, this is a customized SQL query engine that is designed to complete the interactive querying at such a humongous scale and then performs some ad-hoc analysis on the huge Datastores at the backend like Hive, HBase, and Scribes.

Facebook’s massive Compute Architecture

To cater to the ever-increasing compute requirements, Facebook initiated an Open Compute Project.  It uses an extremely complex infrastructure, which is comprised of multiple data centers in different parts of the World, each consisting of thousands of dedicated servers.

There are several thousands of Server Clusters that handle the massive amount of Graph Search queries, User interactions, advertisement delivery, and revenue capture systems.

There is a huge Datastore system created to store pictures, videos, and other User Data, which is capable enough to hold multiple Petabytes of Data generated per month. Facebook achieved this by establishing 12 massive Datacenters across the World.

As per some conservative estimates, Facebook currently has approximately whooping 15 Million Square feet of dedicated Data Center space and many Millions of square feet of space are in the planning stage.

It has more than 30,000 High speed and high-capacity servers, which helps Facebook to cater to the requirements of its end users.

How to make a Facebook Competitor?

Now, this is an important question and this needs to be answered in detail. As we have seen the kind of Technology and Architecture Facebook uses to serve its customers, we must understand that it’s not that easy to create a competitor for Facebook.

Facebook has implemented several pathbreaking customized tools and technologies to ensure they serve their customer’s demands.

However, we have selected a few Technologies and Stack which could be used to create a big platform like Facebook, though we maintained that one must create several tailor-made solutions to fulfill the requirements,

API/Database layer: Here we might choose node.js along with AWS services to create a serverless application, which helps us outsource the Server Management and Provisioning and keep our focus on the application only.

We can use either Elixir or Erlang programming languages to design the APIs, as both languages are used to design and manage the Distributed, Fault-Tolerant, easily upgradable, and scalable applications. to fulfill the requirements of the API/Database layer.

Database: As we have gone through the kind of data Facebook uses, we have very much understood that the traditional data types have been changed. It’s an era of structured and polymorphic kinds of data, as such data is generated by the Mobile apps, Social Media, and other applications based on IoT, Machine learning, and Big Data. Considering the kind of massive amount of data, we may be using; we can choose either MongoDB or SQL.

The Emergence of Social Media and other complex applications gave a huge rise to non-tabular databases, which are also known as NoSQL databases, a NoSQL Database like MongoDB offers the right ability for Developers so that they can exploit the Compute power and Store on-demand capabilities.

On the other hand, SQL is standardized and has a proven track record, it offers a solution to write-oriented transactions and scan-intensive deep analytics. It applies an orthogonal approach to present the data and storage.

It also supports JSON and other structured object formats, which enables it to provide a better performance and more features than NoSQL Database implementations.

On top of that, we may use Elastic search for Distributed and Multitenant full-text searching capability.

Application Layer: Here we may choose either Go or Python, or maybe both, depending on the roles and requirements. Go (Golang) is an open-source and highly concurrent programming language developed by Google.

It offers the functionality which is better suited to developing distributed and scalable applications. Applications created in Go could be directly compiled to the native machine code, and they never require any kind of interpreter or virtual machine for the compilation process. This makes the Applications work faster and has no requirement of warming up.

Python could be used for other critical tasks, like Data Analysis, data mining, machine learning, and Artificial intelligence.

Web frontend and User Interface: To create the Web Frontend and User Interface, we can use either React.js or phoenix elixir. Here React.js is an open-source library, which is based on JavaScript and it is being used for developing custom user interfaces for web-based applications.

It is also used to manage and handle the ‘view layer for applications. Another handy feature of React.js is its ability to create reusable User Interface components.

On the other hand, Phoenix Elixir is a web development framework written in Elixir programming language, where  Elixir is based on the Erlang VM. It is used for building distributed, stable, highly scalable, and fault-tolerant applications.

Phoenix Elixir offers the productivity of frameworks like Ruby on Rails but without sacrificing performance.

Mobile Interface: React native or traditional IOS/Android development

Nowadays, creating an application for Mobile is a must, as most users access the applications from the leisure of their mobile handsets.

Currently, we have React Native, the unarguably the best open-source mobile application framework, which was developed by Facebook itself. We can develop applications for several different platforms like Android, iOS, or the Web via this framework.

If we have decided not to use Facebook’s tools and technologies, then of course we must use other traditional frameworks to develop iOS or Android versions for our application.

Client-Server Communication

As far as Client-Server communication is concerned, Facebook uses a protocol known as Extensible Messaging and Presence Protocol, to carry out the chatting communication and file-sharing functions, but since we won’t be using Facebook’s tools and technologies to create its competitor, hence we have to look for other options.

We believe, we must use the Sockets, which offers real-time notifications and Chat capability while having almost negligible overheads.

Image/Video Processing

It is one of the most crucial aspects of Facebook, as most of the content on Facebook is Images or Videos. To create such a massive Image and Video processing interface, we may use C or C++ with OpenCV, as it will be easy to develop a solution with better performance per resource usage.

Facebook, as we have read above, has developed certain in-house solutions to cater to such demands, however, we won’t be using Facebook’s solutions, hence we may be using GPGPU, which stands for General-purpose computing on graphics processing units.

Which will be performing the computation dedicatedly for computer graphics.

GPGPU is a utilization of a graphics processing unit, which only handles computer graphics. It offers an ability of bidirectional processing, which improves image and video processing to great extent.

OpenCL or CUDA could be used here, where OpenCL is an open-source GPGPU framework that allows computing on graphics processing units to accelerate processing in applications.

On the other hand, the CUDA is a proprietary GPGPU framework developed by renowned player Nvidia, and it comes with the limitation, that it runs only on Nvidia cards.

 

Conclusion

We have tried to understand the Architecture and Technologies used by Facebook to create such a mammoth Social Media platform. The most important aspect of Facebook is that it loves the Open Source frameworks.

It has created several customized applications and technologies, which fit its requirements and enhanced the capabilities of Facebook to an entirely new level.

If someone really wants to compete with Facebook, then we believe the Open Source based Technology Stack is the answer, however, one must make several customized solutions to answer the platform’s concerns.

Facebook has achieved this using a traditional Technology Stack that’s LAMP, however, it has coupled with numerous advancements and customization done by their in-house developer team.

In the end, we are back to the initial question, i.e., Is it possible to create a Facebook Competitor?

To which, our answer is indeed a Big ‘Yes’, however, we would like to add that it needs a lot of innovation and focused approach to derive the Technological advancements to achieve and cater the wishful requirements of our Customers.

Luna Bell
Luna Bellhttps://www.thetechnoweb.com
Luna Bell is a freelance writer. She writes about the latest advances in technology. Passionate about technology, Luna has extensive experience writing articles on design, development, quality control, and machine learning.

Related Articles

Latest Articles