<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sidharth Purohit on Medium]]></title>
        <description><![CDATA[Stories by Sidharth Purohit on Medium]]></description>
        <link>https://medium.com/@sidharthpurohit?source=rss-1aa5473bd62------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aCbqJhc_BGKAD3euCxRHMg.jpeg</url>
            <title>Stories by Sidharth Purohit on Medium</title>
            <link>https://medium.com/@sidharthpurohit?source=rss-1aa5473bd62------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:29:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sidharthpurohit/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[FinOps and a culture shift paradigm]]></title>
            <link>https://medium.com/@sidharthpurohit/finops-and-a-culture-shift-paradigm-e5985c33204f?source=rss-1aa5473bd62------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5985c33204f</guid>
            <dc:creator><![CDATA[Sidharth Purohit]]></dc:creator>
            <pubDate>Wed, 22 Feb 2023 04:31:09 GMT</pubDate>
            <atom:updated>2023-02-22T04:34:57.775Z</atom:updated>
            <content:encoded><![CDATA[<h3>FinOps and a cultural shift paradigm</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xXL0XmSK-yjr6cpEO4pbrQ.png" /></figure><p>Hey folks — its already 2023, and everyone around us is talking about FinOps. This includes — business professionals, CIOs, and even the large media houses. As a cloud developer enthusiast, I recently stumbled upon this term and was curious to know more about it. And now here I am trying to explore more on the domain. So let’s get straight to the point and talk about FinOps!</p><blockquote><strong>What is FinOps and why should we care about it?</strong></blockquote><p>Google defines FinOps as — An Operational framework and cultural shift that brings technology, finance, and business together to drive financial accountability and accelerate business value realization. FinOps, though different in its aims, is similar in concept to <strong><em>DevOps</em></strong>.</p><p>To simply understand, with the traditional legacy softwares in IT like mainframe — which was used in organizations before cloud came — IT teams call for the responsibility of finance team for domain specific queries. Spend was predictable and it was easy to stuck with the budgets set during annual cycles.</p><p><strong>BUT THE CLOUD THEN CHANGED EVERYTHING!</strong></p><p>So now — an engineer at the comfort of their home can spin-off a cloud resource that could cost $500 without getting the approval of finance team or the procurement squad.</p><p>Thus this discipline of <strong>FinOps </strong>provides a new way for teams to manage their cloud costs where everyone takes responsibility for their cloud usage and this is governed by a central team.</p><p>FinOps is often referred as <strong>Cloud Cost Management, Cloud Financial Engineering or Cloud Cost Optimization. </strong>But in reality this discipline of FinOps go well beyond cloud optimization. FinOps is more about making money than saving money!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*62zpPHUWZUl0ba0qq_XRbw.png" /></figure><blockquote>The building blocks of Fin<strong>Ops</strong></blockquote><ol><li><strong>Accountability and Enablement <br></strong>This focuses on establishing a centralized cross-functional team whose responsibility is to set governance, and standards to manage cloud costs across the organization.</li><li><strong>Measurement and Realization<br></strong>This focuses on developing KPIs and business value metrics to track the success of cloud transformation.</li><li><strong>Cost Optimization<br></strong>The idea here is to identify key cost drivers, providing visibility and making a process to constantly optimize cloud costs a priority.</li><li><strong>Planning and Forecasting<br></strong>This building block emphasizes on properly allocating cloud costs and deciding on a proper show-back or chargeback mechanism.</li><li><strong>Tools and Accelerators<br></strong>This is the use of best practice tools to properly allocate and effectively track cloud spend.</li></ol><blockquote>Reasons to care about Cloud FinOps</blockquote><ol><li>Cloud FinOps is here to stay and favors the earlier adoptor. The earlier an organization starts with it — the better edge they have here.</li><li>With the recent economic fluctuations — FinOps is a tool for firms to optimize IT technology and help them get the maximum value from the cloud.</li><li>It is an excellent tool to accelerate digital transformation.</li></ol><p>References :<br><a href="https://www.finops.org/">https://www.finops.org/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5985c33204f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing a generic OTT Streaming service in Cloud : A Netflix case study]]></title>
            <link>https://medium.com/@sidharthpurohit/designing-a-generic-ott-streaming-service-in-cloud-a-netflix-case-study-cd7c8754de60?source=rss-1aa5473bd62------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd7c8754de60</guid>
            <dc:creator><![CDATA[Sidharth Purohit]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 00:19:57 GMT</pubDate>
            <atom:updated>2022-02-10T00:50:07.299Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Designing a generic OTT Streaming service in Cloud : A Netflix case study</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ll4f6tBWOKQGrrG-3Qnqcg.jpeg" /><figcaption><strong>An OTT — NETFLIX</strong></figcaption></figure><p>In recent times there has been a substantial shift in focus for media consumption due to the recent technological advancements in telecommunications and improved gadget capabilities. This shift from traditional media to over-the-top (OTT) media has resulted in a competition among streaming service providers to attract and retain subscribers, especially during the COVID-19 lockdown.</p><p>Ever wondered how Amazon Prime Video operates or how Netflix, Hulu etc get such quality content streaming videos on-demand? The rapid spread of over-the-top (OTT) media has been aided by the internet’s proliferation. It is currently on the verge of having a massive social impact.</p><p>Let’s try to design a system where we implement such a service on the cloud. I have mainly tried to cover the major contributor in this industry — <strong>NETFLIX.</strong></p><p><strong>But first!</strong></p><p>Did you know? OTT services like Netflix have 90% of the traffic supplied globally via direct connections between Open Connect and the residential Internet Service Providers (ISPs) that their members use to connect to the internet. The majority of these connections are restricted to the regional point of interconnection nearest to the member’s viewing location. Thousands of ISPs throughout the world engage eagerly because connections to the Netflix Open Connect network are always free and their traffic delivery is highly localized.</p><p>To learn more — <a href="https://about.netflix.com/en/news/how-netflix-works-with-isps-around-the-globe-to-deliver-a-great-viewing-experience">Great viewing experience</a></p><p>Now you might be wondering What is <strong><em>Open Connect</em></strong> after all?</p><p>Open Connect is a popular “Content Delivery Network” aka CDN. Its task is to supply contents of an OTT organization (Open Connect for Netflix)to its clients using application layer protocols like HTTP/HTTPS. It sends the content query from the client directly to the client’s ISP(Internet Service Providers) and helps store the OTT content in ISP servers, such that the load on OTT servers is less and thus network traffic gets reduced. So now whenever the streaming queries are coming in a bulk, smooth and flawless content delivery is assured by using this mechanism.</p><p>To learn more — <a href="https://openconnect.netflix.com/Open-Connect-Overview.pdf">Open Connect</a></p><p><strong>Fair enough!</strong></p><p>Now that we know how popular OTTs work. Let’s deep dive into its System Design. We will focus by keeping NETFLIX into our consideration. The approach will be similar to what we did in the previous article, it will be a step-by-step construction from High level design to low level design framework. Primarily there will be three essential components for this NETFLIX system.</p><p>1. <em>Client</em> : It is any device from which we play the video. It could be our smartphones, TVs, gaming consoles like playstation or Xbox.</p><p>2. <em>Backend </em>: All the network integration, API calls and system specific design, other than video streaming. We will be using popular AWS apis for designing this backend.</p><p>3. <em>Open Connect </em>: As explained above! More details coming next.</p><p>Note : Anything which doesn’t involve video streaming is handled by AWS cloud and every other component which involves video streaming meta-data is handled by <em>Open Connect </em>as mentioned above<em>.</em></p><p><strong>Let’s Begin!</strong></p><p><strong>High Level System Design</strong></p><p>Below is the approach from a basic standpoint to the complex and efficient system. Feel free to skip to the last section if you are comfortable with basic design problems and countermeasures.</p><p><strong>Step #1 : Load Balancing</strong></p><p>The front end of Netflix is created on React.js, the main advantages React provides are : startup speed, run time performance and the modularity. Netflix uses AWS Elastic load balancer to route the traffic to different instances within an availability zone. These load balancers are designed in a way that the incoming load is first balanced across the zones and then it gets balanced across the instances. This scheme is something which we call a two-tier balancing scheme. The first tier consists of basic round robin based load balancing on various availability zones. And the second tier does the round robin load balancing over the instances, and distributes the request over these instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dpae4KC6hflq9r6glWr86A.jpeg" /><figcaption><strong>Load Balancing across zones and multiple instances</strong></figcaption></figure><p><strong>Step #2 </strong>: <strong>Handling Videos, device specific encoding</strong></p><p>Netflix performs a lot of preprocessing before delivering the content to the user. This preprocessing involves finding errors, converting videos into different resolutions and different formats. All types of video transcoding are performed here. The videos are encoded on the basis of numerous parameters based on the device which is going to operate the video. This video gets converted into various different resolutions, which makes the viewing experience better.</p><p><em>Now, we might think why can’t they deliver original video to every user irrespective of device?</em></p><p>So the answer to this is, resolution errors. A 70 GB video might not be suitable for relatively small screen devices like tablets or smartphones. So we need encoding of some sort to handle this.</p><p>Netflix also maintains over 1000 copies of a video to specifically handle traffic with varying bandwidth, quality and speed. Some users might be on a low network bandwidth thus a low quality video is suitable for them.</p><p>The diagram below shows how Netflix handles a large video coming directly from the video distributor. It first breaks the video down into various fragments, sends it to a large processing queue for analysis and encoding specific tasks, and then the worker nodes function to merge and upload the obtained video chunks into the S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QECX_W-4nFwLCxfZSngHVg.jpeg" /><figcaption><strong>Step by step process of storing various versions of a video file — Transcoding Mechanism</strong></figcaption></figure><p><strong>Step #3 </strong>: <strong>Open Connect and handling network traffic</strong></p><p>Now that we have the video and its various encoded versions. As shown in the figure, the user now gets all the login, recommendation engine, billing, search, account information all delivered via AWS. And the video directly from the Open Connect Server(specific to Netflix). Open Connect is designed to be highly available, fault tolerant and is free of charge service for the ISPs as it is decreasing the bandwidth footprint of an ISP over the internet. Netflix figures out which content is very popular worldwide, and on the basis of popular content, and historically viewed patterns.</p><p>Netflix stores the user activity data at its AWS data centers and provides recommendations to its users based on ML models running at its backend.</p><p>So the moment we click on the play button, the OC server delivers the requested video quality from the nearest OC server. <em>This is how the Netflix server delivers the best quality video to its user!!!.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IBFj2PVBd4TxrSInC9iIYg.jpeg" /><figcaption><strong>Open Connect use case for delivering videos and AWS for Backend errands</strong></figcaption></figure><p><strong>Step #4 </strong>: <strong>ZUUL, now what’s that?</strong></p><p>ZUUL is a gateway service which provides dynamic routing, monitoring, resilience and security. It is also an essential component for connection management and proxying the request. As shown in the below image, the functions of each of the component are as follows -</p><p>1. Netty Proxy — It is where the client request hits first.</p><p>2. Inbound filter — This where the client request gets transferred from Netty proxy. This filter runs before proxying the request and can be used for authentication, routing or decorating the request.</p><p>3. Endpoint filter — Request then goes to the Endpoint filter which is used to either return the static response or to forward the request to backend services. Once the backend services return the response back. Then the endpoint filter forwards the response to the outbound filter.</p><p>4. Outbound filter — The outbound filter after receiving the response, adds or removes the response and sends it back to the Netty server.</p><p><strong>Wait a minute, why does Netflix use a gateway service like ZUUL in the first place?</strong></p><p>There are several advantages of using a gateway service :</p><p>1. <em>Sharding the traffic</em> : To process more transactions per second, sharding is used to horizontally partition the traffic.</p><p>2. <em>Load testing</em></p><p>3. <em>Testing new services</em></p><p>4. <em>Filter bad requests</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSyzXYcwyKHwbgLYFv_cIg.jpeg" /><figcaption><strong>ZUUL gateway</strong></figcaption></figure><p><strong>Step #5 </strong>: <strong>Hystrix</strong></p><p>Hystrix is a latency and fault tolerant library design to isolate the points of access to remote system, services and third party libraries. Figure below shows how Hystrix is used. It allows timing out certain calls if there are errors in a dependency, it automatically rejects the request whenever the thread pool is full, it falls back to default response whenever there is error. The whole idea of using Hystrix in Micro-services is that the user should be able to perform at least the basic tasks, like searching a video or access their dashboard without any error. So APIs which are very critical should stand apart and have least dependencies.</p><p><strong>Step #6 </strong>: <strong>EV Cache</strong></p><p>In any application there will be many endpoints where the data can be cached or the response can be stored in a cache. Such APIs are essential as they release the pressure from the actual servers. But there are certain types of data which can not be cached and we need them every time. So Netflix specifically deals with these types of issues, where they developed their own cache mechanism using memcached trees.</p><p>Netflix has deployed a number of clusters on many EC2 instances in which there are nodes of memcached tree. So whenever a write happens to the EV cache, it writes that response to every cluster/node available. And when a read occurs the cache gets distributed across the network and always occurs from the nearest server, this reduces pressure from the actual endpoints.</p><p>Such caching helps in improving the throughput, reducing the latency and saves cost for maintaining many cache servers.</p><p><strong>Step #6 </strong>: <strong>The Databases : MySQL, Cassandra</strong></p><p>The MySQL database can be used to store billing information, transaction information, and user information in MySQL database as we might need ACID properties. All the big data backed and non relational data is stored in Cassandra.</p><p><strong>Step #7 </strong>: <strong>Data ingestion : Kafka and Apache Chukwa</strong></p><p>Now since the OTT platforms — popular ones like Netflix and Prime are going to produce petabytes of data with billions of events. So we need some data collection and queuing systems. This is where Apache Chukwa comes in, it is an open source data collection system for collecting logs of data or events from distributed systems. It is built on top of HDFS, MapReduce. Chukwa sends data to Amazon Elastic Map Reduce or ElasticSearch and Spark for further analysis.</p><p><strong>Step #8 </strong>: <strong>But Why ElasticSearch(OpenSearch)?</strong></p><p>ElasticSearch comes handy with providing analyses and visualization using Kibana on petabytes of data. Netflix uses more than 150+ ElasticSearch clusters and 3500+ instances to understand the patterns happening inside their system. This facility helps Netflix get more ideas on how their users are getting affected by their video streaming product. Any errors associated with login, signup are managed via this as well, as the complete visual representation comes up on the Kibana dashboard used by ElasticSearch.</p><p><strong>Step #9 </strong>: <strong>Spark as a recommendation engine</strong></p><p>Spark is used for recommendation and personalization, and the majority of large scale ML models can be run on Spark clusters. Such models are then used to do sorting, row selection(what particular row should be shown to a given user) and recommendation. For movie recommendation, Netflix tends to use the user interaction, other user’s taste, metadata of the movie, what time of day the user is active, device type etc. type data to design their recommendation engine.</p><p><strong>Low Level Design of the system<br></strong>All of the above mentioned high level designing concepts can now be interconnected for overall working of the entire system, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uRHk-1r7D3XnH1o7LWYuZQ.jpeg" /><figcaption><strong>Low level system design of NETFLIX System</strong></figcaption></figure><p>If you are still here, Hope you enjoyed reading this article!<br>:)</p><p>Below are some of the links for in-depth understanding of some of the APIs and tools discussed in this article:</p><p><a href="https://chukwa.apache.org/">https://chukwa.apache.org/<br></a><a href="https://github.com/Netflix/Hystrix/">https://github.com/Netflix/Hystrix/<br></a><a href="https://github.com/Netflix/EVCache/">https://github.com/Netflix/EVCache/<br></a><a href="https://about.netflix.com/en/news/how-netflix-works-with-isps-around-the-globe-to-deliver-a-great-viewing-experience">https://about.netflix.com/en/news/how-netflix-works-with-isps-around-the-globe-to-deliver-a-great-viewing-experience<br></a><a href="https://openconnect.netflix.com/Open-Connect-Overview.pdf">https://openconnect.netflix.com/Open-Connect-Overview.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd7c8754de60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Designing basics- Designing a Distributed Storage Service in Cloud]]></title>
            <link>https://medium.com/@sidharthpurohit/system-designing-basics-designing-a-distributed-storage-service-in-cloud-a91ed91dfb22?source=rss-1aa5473bd62------2</link>
            <guid isPermaLink="false">https://medium.com/p/a91ed91dfb22</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Sidharth Purohit]]></dc:creator>
            <pubDate>Sun, 06 Feb 2022 03:14:45 GMT</pubDate>
            <atom:updated>2022-02-06T03:14:45.901Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cqXyRcXYIJxgZ3ou" /></figure><p>Ever wondered how Amazon S3 operates? How do our files get automatically scaled as per our requirement? Let’s try to design a system where we implement a replica of a Distributed Storage like AWS S3 service or Azure Blob or Google Storage. I will begin by exploring how a real time system functions, that is by scaling as we get more users, countering all issues as we face along the way. First lets cover the very basics —</p><p><strong>What is System Design?</strong></p><p>The process of defining the components, modules, interfaces, and data for a system in order to meet specific criteria is known as system design. The process of building or altering systems, as well as the procedures, techniques, models, and methodologies required to do so, is referred to as system development.</p><p><strong>What is a Distributed Storage System in a cloud?</strong></p><p>A distributed storage system is a type of architecture that allows data to be shared among numerous physical servers and, in some cases, multiple data centers. It usually takes the form of a storage cluster with a data synchronization and coordination mechanism amongst cluster nodes.</p><p>We are here to design something similar to massively scalable cloud storage systems like Amazon S3 and Microsoft Azure Blob Storage. When we upload files on these systems, the system scales automatically and they are called scalable or elastic systems. This works on a pay-as-you-use model. We pay for the services, memory or storage as per our usage.</p><p>In this article we aim to design such a system. The focus is on real time system designing and the article acts as a good resource for System Design interview preparation.</p><p><strong>What are the primary purposes of our system?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYxj7iaa9L_pg7Ttq7eSLg.jpeg" /></figure><p>1. <em>Durability</em> — Our system should be highly durable, once uploaded the file should not get lost.</p><p>2. <em>Availability</em> — The system should be available without any delay for the end user.</p><p>3. <em>Multi-tenancy</em> — The system should support multiple people uploading different objects into it, without any difficulty. It should not be separately deployed for each and every customer. Each customer should be able to upload on their own console and should be able to see their own files. Therefore ideally, one system should handle all the customers.</p><p>4. <em>Scalability</em> — The system should be scalable, once uploaded the customer should not worry about the extensibility of a system, no matter how many files they keep on uploading.</p><p>5. <em>Security</em> — We should ensure that the APIs are working properly over https and content should be securely stored over our storing system. Using something like SSL.</p><p><strong>Let’s Begin!</strong></p><p><strong>High Level System Design</strong></p><p>Below is the approach from a basic standpoint to the complex and efficient system. Feel free to skip to the last section if you are comfortable with basic design problems and countermeasures.</p><p><strong>1. A basic design #1: </strong>A very basic and naive approach can be using a single server with some APIs exposed, let’s assume it has some 50 TB capacity. Thus this server has an API part and a data storage part. So a simple strategy is a user creating a simple bucket and starts uploading all his files in that bucket.</p><p><strong>THE PROBLEM</strong> here is — This system does not support parallel read and write operations, the APIs here are limited to handle only a certain amount of traffic, there is always a limit on number of Input/Output operations performed. So this system is <strong>not SCALABLE</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*av4XTwv0xO6xrwMJRKIRPA.jpeg" /><figcaption><strong>A basic system with one user and one server — with exposed APIs and Data Storage</strong></figcaption></figure><p><strong>2. Basic Design #2 </strong>:</p><p>To make the system scalable we make the system scale horizontally, where let us say have doubled the capacity for traffic handling. We can use a Load Balancer at the client’s end.</p><p><strong>THE PROBLEM</strong> here is — This system will create an error, whenever the user tries to fetch a file which is not in a particular server. The system will respond that the file is not available. And thus this is not <strong>RELIABLE.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nkHB2mUKcMzctNPsyYcmmQ.jpeg" /><figcaption><strong>A slight scalable high level design to handle queries facilitated by a Load Balancer (LB)</strong></figcaption></figure><p><strong>3. Basic Design #3 : </strong>We can solve the reliability problem faced above by dividing our API part and the data storage part. So the API servers now act as a commodity machine (mostly have CPU and hard disk capabilities). We can add a meta-data service which ensures and redirects the user to the correct server wherever the file is present.</p><p><strong>THE PROBLEM</strong> (and RESOLUTION )here is — This system will create an error, whenever the meta-data server fails, so it will require scaling. Now what if the data storage part fails, so we need it’s replication too. This whole allocation and replication process will be handled by this scaled Meta-data server, it can send heartbeat signals to the data storage servers and ensure the health of it, by allowing creating replicas and where to create too. We will create replicas in different regions so as if all of the servers in a region go down, the user should be able to get his data back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*axJ0AqkRvKuyVOE0Zcpqog.jpeg" /><figcaption><strong>A relatively scaleable and reliable high level design</strong></figcaption></figure><p><strong>Low Level System Design</strong></p><p><strong>What does the system ideally be doing?</strong></p><p>User comes up with the file, and subdomain of the bucket. The request goes to the DNS server and the traffic gets redirected to the Load balancer. The load balancer then decides on the basis of its various API strategies about which specific API server to be picked. It could be on the basis of Node dropping or could be absolutely random.</p><p>API server now validates if the user with a specific api key is authenticated to perform the upload operation or not. The diagram below is divided into 2 Layers — <strong>Partitioning layer and Streaming layer</strong> each with their respective task.</p><p>So when the file comes to the API server, it checks from the partition layer which partition server should handle this request. The partition layer contains a partition map which deals with what mapping of files should go in which partition server. Partition layer helps in parallelizing and scaling, whenever a large number of files are coming from the user, the hashing mechanism with the partition layer will help in allocating specific files to particular file servers.</p><p>When a file comes to a server, the API server assigns a unique ID to this file. The hashed file number then gets allocated to a partition server. Each partition server has a range for handling a hashed file.</p><p>Once a partition server gets the file it talks directly with the streaming layer. Streaming layer contains many streaming servers, where each of these stream servers acts as a linked list of file servers. They will keep on adding new file servers from the head.</p><p><strong>Streaming Layer :</strong></p><p>This layer is responsible for getting a file from the partition server and storing it into the hard disk. The responsibilities of Streaming server includes — Appending new servers and files into the particular streaming server, sealing a particular partition server whenever its full, Implementing garbage collection on the file servers, <strong>replication of files(</strong>Streaming manager stores the information of which region other than the current have empty locations where the current file can be replicated.<strong>) </strong>and handling periodic checks on the server, checking the health of file systems.</p><p><strong>Partition Layer :</strong></p><p>Partition servers handle the mapping of the file and the file servers. And the partition manager is responsible for assigning the partition to a specific file using a range of partition ids. Partition manager also checks the load on partition servers. If any of the partition servers goes down, the manager automatically assigns a new partition server and updates the partition map table.</p><p><strong>Cache Layer :</strong></p><p>If a request for a file is repeated, instead of going inside the whole partition and file server, the file instance gets saved in the Cache layer.</p><p>We use zookeeper/lock manager as we know there could be multiple stream managers and partition managers running, we want only one of them to function at a time. To keep track of that, we use zookeeper to decide which one of the stream managers is the master.</p><p><strong>Note : </strong>If anything happens to the primary cluster, all the data stored in partition database and the streaming database gets updated to the secondary cluster in some other region, using cluster manager.</p><p>The idea is, one of the cluster regions will handle all the writes, it also has the functionality to serve the read operations and the other two will specifically handle all the data replication, and serve for reading purposes.</p><p>So in the image attached below only region-1 has been shown, a similar copy will be there for region-2 and other subsequent regions. Only difference being, region-2 and others won’t have DNS server, Load Balancer and Cluster Manager. As they are specific to region-1, the primary entry point of the application, only.</p><p>As mentioned above, since we are dealing with clusters in various regions where the data and files are getting replicated, we will deal with the <strong><em>Cluster manager. </em></strong>Cluster manager is a program which is upper in the hierarchy and handles functioning of all the clusters in all the regions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4tLYxyoS9twuObQif7BQw.jpeg" /><figcaption><strong>Low level design of complete end to end Storage system</strong></figcaption></figure><p>Finally, the <strong>Cluster Manager</strong> has following functions :</p><p>1. <strong>User Account creation and bucket allocation </strong>— Whenever the end user creates a new account with our Storage application, they get redirected to the cluster manager, the cluster manager facilitates the user by allocating a subdomain with the bucket name and adding this entry in the DNS server with the IP address of Load Balancer.</p><p>Now Load Balancer(LB) here acts as an entry point to all requests coming to our distributed storage system.</p><p>2. <strong>Managing disasters and other hazards</strong> — Whenever the region -1 fails, the load balancer will direct the request traffic to other clusters and will let this system recover.</p><p>3. <strong>Resource tracking</strong> — Cluster manager also manages all the resources utilized, exhausted inside the clusters, how much space is left. Acts as an elastic storage.</p><p>4. Keep track of all the policies and authorizations, store it in the database. And manages overall flow of the cluster.</p><p>If you are still here, Hope you enjoyed reading this article!</p><p>:)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a91ed91dfb22" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>