In 2016, Facebook launched a feature that allows people to share videos in real-time. The traffic pattern in live videos is unlike regular videos. There is a steep rise in the initial traffic. The traffic in live streams is also very irregular. It gets much more traffic than standard videos, but the traffic can also suddenly drop. This unusual traffic puts a significant load on the caching system. To prevent overloading the system, Facebook distributes traffic to points of presence (PoPs) around the world.
Fig: Facebook livestreams architecture
Within the PoPs, there are two layers. One is a layer of HTTP proxies, and another is a layer of cache. Viewers request a segment from an HTTP proxy. If the segment is in the cache, it is returned. Otherwise, a request for the segment is sent to the datacenter. Since different parts are stored in various caches, the load is balanced. The load for each PoP is measured, and the user is directed to the closest PoP with sufficient capacity. Load predicting algorithms are crucial to this process.
Twitter achieved this insane feat by decoupling media upload from tweeting. This gave them a lot of flexibility in how an upload was handled. The client talks to TFE (Twitter Front End), and TFE talks to Image Service. The Image Service adds the data into a Metadata store. Then it creates a unique identifier called mediaId for the media. MediaId is used as a reference to handle the media. Twitter also made media uploads segmentable and resumable.
Fig: Twitter architecture
First, the client initializes the upload session with the upload API. Then, the backend will give it a mediaId. This mediaId is used for the rest of the session. Each image is divided into many segments. These segments are appended using the API. Once the upload is completed, it is finalized, and the media is ready to be used. Each segment can be retried. Therefore, this method is more resilient to network failures.
The two most important aspects of an app are frontend and backend. So, choosing the right technology stack for each part is crucial.
This is the user interface of the application. The user spends all their time interacting with the UI. Hence, frontend is an essential part of a social networking app. Ionic framework, React, and Redux are excellent options for mobile frontend. The most popular and widely used frontend frameworks include AngularJS and ReactJS. Both are open-source and are developed by Google and Facebook, respectively.
Along with the optimization of page content and libraries, the use of CDN also ensures that the application has a faster load time. It loads content from the nearest location of the user. The use of AWS Cloudfront can make a significant difference in terms of loading speed along with supporting caching strategy.
Node.js is the most famous tool used for backend development. It can be used to create dynamic social media apps with chats, likes, and comments. It also has excellent data processing capabilities. By pairing Node.js with Ember.js, you can make your application scalable. Microservice application strategy must be followed to create scalable applications. If you create a microservice for a social networking app, it can be scaled easily. Therefore, even if it goes down, the entire site will not be affected.
The use of technologies like Queue can also help in batch processing huge asynchronous requests like sending emails, notifications on the backend.
Social media apps require a lot of processing power to process enormous amounts of data. Most social media apps use JSON format. Many prominent databases support this format. You can choose from options like SQLite, MySQL, or NoSQL database.
For such applications, speed is critical. Hence, developers have to design the database layer considering read latency, write latency, etc., while making sure it has support in different regions.
In today’s world, social media has become a means for billions of people to get information about the world. Something that started as a way to connect has become something much more significant today. As a result, social media plays a very prominent role in contemporary society. With such an enormous user base, it is also one of the biggest markets. In case you were thinking of entering this market, there is no better time to do so. Remember to put great emphasis on both frontend and backend development. Right from the start of the process, you must take steps to ensure that your app is scalable. If you want your app to be successful, you must prepare for that success in the right way.
What’s on your mind? Tell us a little bit about yourself and your question, and we will be in touch with you within 12 hours
Free eBook on Telemedicine Platform Development: All About TelemedicineDownload Free eBook Now!