facebookpixelcode
g12

Product Strategy and Consulting

Get your tactical roadmap to success.

Dedicated Product Team

Scale your team instantly and hit the ground running.

MVP Development

Fast-track your journey to product-market fit.

Co-Development Program

Let’s navigate growth, together.

© Copyright  2024 Siam Computing. All Rights Reserved.

UI/UX Design

Elevate your product with designs that captivate and resonate.

DevOps

Enhance your operations with our DevOps expertise.

Coding & Testing

Discover our technology acumen and unleash the full potential of your product.

AI & Chatbot

Transform your user interactions with AI brilliance

© Copyright  2024 Siam Computing. All Rights Reserved.

Who we are

Learn about our journey and meet our team.

Careers

Apply to jobs in Siam and join our team.

Graduate Training Program

Knowledge-focused career development program for graduates.

© Copyright  2024 Siam Computing. All Rights Reserved.

Blog

Deeply written articles on strategy, design, technology, and business.

Our weekly newsletter

Weekly mailer with techbiz updates and insights for product leaders.

ProdWrks

Community and publication for product builders and problem solvers.

Case Studies

Outcomes of our strategic design and development journey.

© Copyright  2024 Siam Computing. All Rights Reserved.

MVP Development
Revamp Single Post
8 MIN. READ

Decoding The Ideal System Design For A Social Media App’s News Feed

The orchestration of code, infrastructure and user-centric principles behind social platforms.

This blog explores the intricacies of code, infrastructure and user-centric design that go into the making of our favourite social media apps like Instagram and Tiktok. Dive into the key strategies that create a relevant and personalized news feed for billions of users.

Chapters
Chapters

The news feed of popular social media apps like Instagram and TikTok needs to be designed with precision, taking each of its individual constituents into account. The intricate balance of data, algorithms and caching systems is central to their success as they shape up the experience of millions of users, each desiring the most relevant version of the product for themselves. In the words of Jeff Bezos (who said this in the context of e-commerce), “If we have 4.5 million customers, we shouldn’t have one store. We should have 4.5 million stores.”

Challenges in delivering this degree of relevance for social media news feeds range from accommodating diverse types, security concerns, ensuring consistent user engagement amidst upsurge of data activity and at scale. It is here that system design can help craft life-like experiences for users’ consistent engagement. In this blog, we will understand system design in detail to gather actionable insights for curating a relevant news feed and analyze intricacies that need to be balanced for the platform’s success.

Systems Design

Simply put, systems design is the process of implementing different elements of a system like architecture, modules, components, their interfaces and data for effectively meeting specific business requirements. This is a structured approach for ensuring a consistent and well-running system. System design provides actionable data insights and information about a system and its elements to ensure that the implementation is consistent with the entities defined in the views and models of the system architecture.

Let us now take a look at the different elements of a system:

  • Architecture: The conceptual model that specifies the behavior, structure and more views of a system.
  • Modules: Individual components handling specific tasks in a system, which is a combination of these modules.
  • Components: Made up of modules, they cater to specific functions or groups of related functions.
  • Interfaces: The shared boundary for components of a system to relate and exchange information.
  • Data: Management of information flow.

Decoding the Ideal System Design For High Performance and Scalability

Pre-Computing Feeds

To ensure real-time updates, the instant users post content, follower feeds can be pre-computed and updated. As soon as a user uploads a post, the system already starts updating the feeds of large groups of followers to ensure immediate accessibility. This is what the process looks like:

Step 1: Content Analysis- Whenever a user uploads a post, the system rapidly assesses the content, including tags, captions, and media metadata.

Step 2: Identification of Followers- The system identifies all the followers of the user who posted the content.

Step 3: Batch Processing- Instead of processing each follower’s feed individually, followers are grouped into manageable batches.

Step 4: Feed Update- Each batch’s news feed is updated with the new post in real-time. This means adding the new content to their existing feed in the order determined by the platform’s algorithm.

Step 5: Cache Refresh- Cached versions of user feeds are updated so that when they access the platform next, they immediately see the latest content without any lag.

Load Balancers and Gateways

Load Balancers and Gateway

Load balancers and gateways help distribute incoming requests across servers, ensuring no single server is overwhelmed. In instances of popular events like a major celebrity post, the sudden spike in user activity is managed by these balancers to ensure smooth performance. These are the steps the process follows:

Step 1: Request Monitoring- Constantly monitor the incoming user requests and traffic patterns to detect any spikes or unusual activities.

Step 2: Distribution Algorithm- The load balancer utilizes a distribution algorithm, like Round Robin or Least Connections, to decide which server should handle a particular request.

Step 3: Server Health Checks- Continuous health checks are performed to ensure all servers are responding correctly. Non-responsive servers are temporarily removed from the pool.

Step 4: Traffic Redirection- In case of overwhelming spikes, traffic can be redirected to a backup infrastructure or to servers with lighter loads.

Step 5: Session Persistence- Ensuring users maintain session persistence, meaning they interact with the same server for the entirety of their session when required.

Hybrid Notification System

A hybrid notification system combines pull and push systems to adapt to user needs. For users with a high follower count, instead of sending millions of push notifications, a pull system can notify them of cumulative activity. These are the steps the process follows:

Step 1: User Activity Analysis- Track the number and type of interactions a user receives, and segment them by likes, comments, followers, etc.

Step 2: Push Notification Threshold- Set a limit or threshold for direct push notifications. For instance, for every 10 interactions, a push notification could be sent.

Step 3: Cumulative Notifications- For high-frequency users or posts with massive interaction, switch to pull-based notifications. Here, instead of real-time alerts, users get cumulative updates, like “You have 1000 new interactions.”

Step 4: User Preference Settings- Allow users to customize their notification preferences, offering them control over the frequency and type of notifications they receive.

Step 5: Backend Synchronization- Ensure both push and pull notification systems are synchronized to avoid redundancy or overlaps.

Activity and Post Service

Activity and Post Service

Splitting responsibilities ensures better management. One system handles content uploads, while another manages interactions like comments and likes. When a post goes viral, for example, the Activity Service can manage the influx of likes and comments, while the Post Service ensures that the post is delivered efficiently to new viewers.

Step 1: Service Segregation- Divide the main functions into distinct services – one dedicated to managing content uploads (Post Service) and another for interactions (Activity Service).

Step 2: Data Partitioning- Partition the data so that related data is stored together, making retrieval faster and more efficient.

Step 3: Real-time Analysis- As content is posted, the Post Service works in tandem with algorithms to prioritize and categorize it.

Step 4: Interaction Management- The Activity Service tracks interactions. For viral posts, this service scales to accommodate the influx, ensuring users can like, share, or comment without any glitches.

Step 5: Synchronization– Regularly synchronize the Post and Activity Services to ensure the feed reflects the latest content and its associated interactions accurately.

Distributed Database System

By breaking data into smaller chunks through Data Partitioning, we achieve increased efficiency and speed. It is much like having multiple checkout counters in a supermarket, allowing more customers to be served simultaneously. When it comes to Geographical Placement, storing user data close to their location ensures faster access and reduced waiting times, much in the way a local warehouse delivers your online purchases the same day. With Replication, we create backup copies of data to guarantee its constant availability. This is akin to keeping spare keys to your house; even if one is lost, you still have access. And with Load Balancing, redirecting user requests ensures no server gets overwhelmed, just as traffic lights evenly distribute the flow of cars to prevent road congestion.

Real-time Data Streaming

For Real-time Updates, technologies like Apache Kafka can ensure that as soon as data is produced (like a new post or story), it is made available to consumers (followers or subscribers) in near real-time.

In the realm of Data Producers Identification, pinpointing where data originates lets us organize and process it more effectively, not unlike sorting incoming mail by its sender. With Stream Initialization, we ensure that data flows smoothly from its source to its destination, reminiscent of conveyor belts at the airport efficiently routing each piece of luggage to its correct flight.

Containerization and Orchestration

Addressing scalability issues as popular platforms evolve with growing number of users, using technologies like Docker and Kubernetes allow the platform to quickly scale services up or down based on demand. If a celebrity with millions of followers goes live, additional resources can be provisioned in seconds.

With Containerization, isolating each application segment ensures consistent performance and reduced conflicts. Imagine using Tupperware containers in a fridge; each food item is kept separate, preserving its individual taste and preventing any cross-contamination. The Kubernetes Setup offers centralized management, ensuring that each component works at its best, much like a conductor guiding an orchestra to ensure each musician plays in perfect harmony.

Content Recommendation Engine

For a seamless user experience and personalization, this engine, powered by machine learning, continually refines its understanding of user preferences. It then curates a feed that blends familiar content with new, relevant discoveries.

Through Data Collection, we gain insights into user behaviors, helping curate a more personal experience. It is comparable to having a personal shopper familiar with your style, always selecting clothes you’ll love. With Model Training, continuously refining our understanding of users’ likes and dislikes ensures our recommendations improve over time. This process is analogous to a radio DJ who, after learning your favorite songs, curates a playlist with more music from your preferred genre.

Multi-layered Security Protocols

By employing Data Encryption, we ensure that data remains confidential and undecipherable to outsiders, much like writing a diary in a secret language that only you can understand. Through Access Controls, we provide data access only to those authorized, creating a safeguard similar to a members-only club where entry is granted solely to those with a special card.

Adaptive Bitrate Streaming

For multimedia optimization across different devices, internet speeds and regions, the system serves videos at varying bit rates. This ensures smooth playback, even on slower connections, without buffering.

The process of Connection Speed Detection involves adapting video playback based on a user’s internet speed to guarantee a smooth viewing experience. By using Bitrate Selection, choosing the best balance between video quality and speed ensures a seamless viewing experience, akin to a car shifting gears for optimal speed without overworking the engine.

Cost-Effective Storage Solutions

For managing infrastructure costs while handling billions of interactions and posts that demand significant computational; power, instead of storing every piece of media in the highest resolution, the system can store multiple versions. A user with a 4G connection might be served a 1080p video, while someone on a slower connection might receive a 480p version, optimizing storage costs and user experience.

By undergoing Media Analysis, understanding the specific type of content allows us to store it in the most space-efficient format. It is much like neatly folding clothes based on their type to maximize wardrobe space. Transcoding refers to the process of converting media so it is accessible on any device or connection speed, similar to ensuring a movie is available in both Blu-ray and DVD formats for varied viewers.

Final Thoughts

Imagine a vast, intricately designed clock. To an observer, the hands move seamlessly, marking time with quiet precision. But behind its face lies a complex mechanism of gears and springs working tirelessly. Apps like TikTok, Instagram’s news feed mirrors this clock: simple and elegant on the surface, but underpinned by a maze of algorithms and systems. The platform’s genius is not just in its technical prowess but in the harmony of its design – an orchestra of code, infrastructure, and user-centric design principles.

For anyone stepping into the realm of system design, social media apps like TikTok, Instagram serve as both inspiration and a benchmark. They are reminders that at the intersection of technology and design lies the potential to craft experiences that resonate with billions.

As the Chief Technology Officer of Siam Computing Murugesapandian is our north star, ensuring efficient, profitable, and secure use of technologies for our clients and their end-users. From MIT accolades to streamlining one of Asia's busiest ports, Murugesh's 13-year journey as a technology leader reflects a commitment to simplicity and problem-solving, one code at a time.

More insights

Women are 50% of global population, yet most technology is built for men. Let’s change that.

Productivity

Women make up half of the global population, yet most technology is largely built with men in mind. It was

7 MIN. READ
How Can Healthcare Providers Leverage Patient Generated Health Data?

Productivity

Imagine a world where healthcare providers have access to real-time, comprehensive data about their patient’s health and wellness, allowing them

7 MIN. READ
Women are 50% of global population, yet most technology is built for men. Let’s change that.

Productivity

Women are 50% of global population, yet most technology is built for men. Let’s change that.

Women make up half of the global population, yet most technology is largely built with men in

7 MIN. READ
How Can Healthcare Providers Leverage Patient Generated Health Data?

Productivity

How Can Healthcare Providers Leverage Patient Generated Health Data?

Imagine a world where healthcare providers have access to real-time, comprehensive data about their patient’s health and

7 MIN. READ
Subscribe to our Newsletter
Get weekly insights into the world of products and techbiz, served with a slice of humor.
— Read by 4000+ founders

SUBSCRIBE
TO TWIP

Get six new insights into the world of products and techbiz every week.

Join 4000+ founders.

Get in touch

Please share your details and one of our Product Strategist would get back to you shortly

We appreciate you for getting in touch with us!

Someone from our team will reach out to you within the next 24 hours. If you’d like to skip the line and directly book a consultation with us.

Contact Page Revamp