Posts

Terraform Basics

Image
Disadvantages of Data Center Deployment Time to set up Many manual steps involved Under utilization of resources e.g. unused web sites during night time Costly IaC (Infrastructure as Code) Hence IaC comes into picture which is API based and provisions resources in cloud  environment. Basically it can configures the entire provisioning environment. Types of infrastructure components are web servers, databases, networks 3 types of Iac 1. Configuration Management Ansible Puppet SaltStack      on existing Infrastructure componenets. 2. Server Templating Docker Packer Vagrant Usually create images on VM or containers 3. Provisioning Tools Terraform Cloud Formation Provision Infrastructure components using simple declarative code. Terraform - Infrastructure Provisioning tool for various cloud platforms. Providers Providers enable Terraform to provision various infrastructure components. Infrastructure Components on cloud platforms Network Components - BigIp, Infoblox Data ...

Twitter Design

Image
Business Function? Registration? Security? Scalability? ** Further define the problem, make it clear and more concrete ** Focus on Core Features Business Function Follow People View Other Feeds Data Modelling Feed Serve - Get all feed from people you follow and render them by time (order) Q1. So many feeds, how many can they be rendered on 1 view? Infinite scroll, only N feeds are fetched at a time. Backend cache Q2. Detect Fake Users - Machine Learning Registration Date - Valid?? Very young vs very old No. of Followers - Extraordinary Large No of Feeds - Extraordinary Large Tweet Ordering using some methods User Liking User relationship to the author. Number of replies/retweets to his tweets No. of followers of the author User favourite number of tweets by some author  Trending Topics Most frequent hashtags over last N hours Hottest search queries Most favourite tweets over last N hours and extract common words or phrases Ranking Frequency (retweets may be) (Topic - # or query or ...

Youtube Design

Problems Storage? Scalability? Web Server? Cache? Web Server * Multiple Web Servers behind load balancer * User Authentication * Sessions * Fetching and Updating Users Data * Video Server * Multiple Web Servers behind load balancer * Recommendation Server * Multiple Web Servers behind load balancer Storage MySQL Database: Lets assume videos have comments and likes and comments do not have likes Table:UserDetails Fields: UserId, Name, Email, Reg Data, Profile Information(Address, Age etc.) Table: User Fields: UserId, Email, Username, Password, Reg Date Table: Video Fields: VideoId, UserId, Title, Description, Size, Video File, LikeCount, ViewCount Table: VideoComments Fields: VideoId, UserId, Comment, Date Table: VideoLike Fields: VideoId, UserId, Date SQL is Geo Replicated Video and Image Storage Thumbnails of different sizes for different screens. CDN - Proxy servers deployed in multiple data centres. Provide Availability, Scalability and Performance Popular videos go on CDN. less pop...