<?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 Sai Balaji on Medium]]></title>
        <description><![CDATA[Stories by Sai Balaji on Medium]]></description>
        <link>https://medium.com/@saibalaji4?source=rss-c90d3f8a26f5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*E8DTm1Bao_4uVqyHG862WQ.jpeg</url>
            <title>Stories by Sai Balaji on Medium</title>
            <link>https://medium.com/@saibalaji4?source=rss-c90d3f8a26f5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 05:42:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saibalaji4/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[Dissecting the Ethereum Networking Stack: Node Discovery]]></title>
            <link>https://medium.com/coinmonks/dissecting-the-ethereum-networking-stack-node-discovery-4b3f7895f83f?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b3f7895f83f</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[tcp]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[proof-of-stake]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Fri, 14 Oct 2022 13:54:27 GMT</pubDate>
            <atom:updated>2022-11-02T02:34:21.812Z</atom:updated>
            <content:encoded><![CDATA[<p>In the last few days, I got a chance to spin up a Eth2 validator node and dive into the depths of the Ethereum N/w stack using some traditional (ahem!) tools such as tcpdump. One of the things I learnt from this exercise is that the Eth n/w stack is being continuously worked upon &amp; upgraded with a lot of EIPs (improvement proposals) floating around.</p><p>As you know, the latest “Merge” didn’t actually signify a deployment of a new Eth network. It was purely an upgrade of the previous Eth n/w. In other words, Eth1 is now known as the “Execution Layer” where smart contracts &amp; n/w protocols reside &amp; operate, while Eth2 is referred to as the “consensus layer”, which ensures the participants of the n/w behave in accordance with the incentive structure &amp; consensus rules (PoW to PoS).</p><p>In this blog, we will look at three things</p><ul><li>A quick overview of the Eth Networking Stack</li><li>Ethereum Node/Peer Discovery over devp2p</li><li>Tcpdump traces to observe packet level details and verify the stack behavior</li></ul><p>So basically, an Ethereum client (e.g. geth) has two main layers/clients sitting on the same node, each with its own networking stack and subprotocols.</p><ol><li>Execution Layer</li><li>Consensus Layer</li></ol><p><strong>What happens in the Execution Layer?</strong></p><ul><li>This is where the EVM resides</li><li>Responsible for transaction building, execution &amp; state management</li><li>Also sends “Gossip” transactions over the p2p n/w with encrypted communication amongst peers</li></ul><p><strong>What happens in the Consensus Layer?</strong></p><ul><li>Responsible for maintaining consensus chain (beacon chain) and processing the consensus blocks (beacon blocks) and attestations received from other peers</li></ul><p><strong>Now, when/how do these two layers interact with each other?</strong></p><ul><li>Each beacon block contains an execution payload. This payload contains a list of transactions and other data required to execute and validate the payload</li><li>In order to check this validity condition, the consensus layer sends the payload to the execution layer over the local RPC connection</li><li>The execution layer assembles the execution block, verifies the pre-conditions, executes transactions and verifies post-conditions. The result is sent back to the consensus layer</li><li>Execution layer passes validation data back to consensus layer, block now considered to be validated (local RPC connection)</li><li>Consensus layer adds block to head of its own blockchain and attests to it, broadcasting the attestation over the network (consensus p2p)</li></ul><p>I like the following representation of this flow in the official<a href="https://ethereum.org/en/developers/docs/networking-layer/"> Ethereum doc</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*hfaBVVpxO3hr9I_j.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*9fLh1zWePlpkGz9k.png" /></figure><p>Now, the exec layer n/w protocols is divided into two stacks and both these stacks run in parallel</p><ol><li>Node Discovery — Allows a new node to find peers to connect to over UDP</li><li>Information Exchange — Enables node to exchange information over</li></ol><p>Here’s what the high level n/w architecture looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tyE85u1O_-srtgbbe0EQtA.png" /><figcaption>The Eth client (node) sits on top of this stack</figcaption></figure><p>In this blog, we will look into the “discv4 Node Discovery” in detail</p><p><strong>What is “Node Discovery” and why do we need it?</strong></p><ul><li>The process of finding other peers in the n/w for data exchange and communication. It is implemented by the client s/w running on the p2p network. In our case, it is one of the Eth clients (gETh is used in our example below)</li><li>The client uses a bootstrapping mechanism to connect to a small set of bootnodes, which are hardcoded into the client</li><li>A Bootnode’s only responsibility is to introduce a new node to a set of peers. It doesn’t participate in chain tasks like syncing the chain. Used only when the client is spun up for the first time</li></ul><p><strong>How does the discovery work under the hoods?</strong></p><ul><li>A modified form of <a href="https://medium.com/coinmonks/a-brief-overview-of-kademlia-and-its-use-in-various-decentralized-platforms-da08a7f72b8f">Kademlia</a> is used where every node shares the lists of nodes in a distributed hash table</li><li>Each node has a list of closest nodes in its table. This closeness is not ‘geographical’, but definition by the similarity of node’s ID (Use XOR to determine the closeness. More details <a href="https://medium.com/coinmonks/a-brief-overview-of-kademlia-and-its-use-in-various-decentralized-platforms-da08a7f72b8f">here</a>)</li><li>The discovery process happens over UDP. Unlike TCP, UDP does not have any additional overhead like error checking, retransmissions etc. This makes the discovery fast.</li><li>On a high level, the process begins by the client playing PING/PONG with the bootnode. Once connected, it gets the list of nodes/neighbors from this node and keeps traversing through the list until sufficient no of peers have been added to the peer list</li><li>start client → connect to bootnode (Ping/Pong ) → bond to bootnode (Ping/Pong) → find neighbours (FindNode) → bond to nighbors -&gt; Exchange information</li></ul><p>Let’s break this whole process step-by-step now. I used the latest gth client and wireshark to capture these traces. Also, you will have to install this <a href="https://github.com/bcsecorg/ethereum_devp2p_wireshark_dissector">ethereum dissector plugin </a>on wireshark to decode the devp2p traffic</p><ol><li>Once the client starts, the bootnodes are identified from the hardcoded list. Since I’m running gEth on the goerli tesnet, here’s the list of bootnodes pertaining to goerli. You can find the full list <a href="https://github.com/ethereum/go-ethereum/blob/master/params/bootnodes.go">here</a></li></ol><pre>// GoerliBootnodes are the enode URLs of the P2P bootstrap nodes running on the // Görli test network.</pre><pre>var GoerliBootnodes = []string{</pre><pre>// Upstream bootnodes  &quot;enode://011f758e6552d105183b1761c5e2dea0111bc20fd5f6422bc7f91e0fabbec9a6595caf6239b37feb773dddd3f87240d99d859431891e4a642cf2a0a9e6cbb98a@51.141.78.53:30303&quot;,  &quot;enode://176b9417f511d05b6b2cf3e34b756cf0a7096b3094572a8f6ef4cdcb9d1f9d00683bf0f83347eebdf3b81c3521c2332086d9592802230bf528eaf606a1d9677b@13.93.54.137:30303&quot;,  &quot;enode://46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291@94.237.54.114:30313&quot;,  &quot;enode://b5948a2d3e9d486c4d75bf32713221c2bd6cf86463302339299bd227dc2e276cd5a1c7ca4f43a0e9122fe9af884efed563bd2a1fd28661f3b5f5ad7bf1de5949@18.218.250.66:30303&quot;,</pre><pre>// Ethereum Foundation bootnode  &quot;enode://a61215641fb8714a373c80edbfa0ea8878243193f57c96eeb44d0bc019ef295abd4e044fd619bfc4c59731a73fb79afe84e9ab6da0c743ceb479cbb6d263fa91@3.11.147.67:30303&quot;,</pre><pre>// Goerli Initiative bootnodes  &quot;enode://d4f764a48ec2a8ecf883735776fdefe0a3949eb0ca476bd7bc8d0954a9defe8fea15ae5da7d40b5d2d59ce9524a99daedadf6da6283fca492cc80b53689fb3b3@46.4.99.122:32109&quot;,  &quot;enode://d2b720352e8216c9efc470091aa91ddafc53e222b32780f505c817ceef69e01d5b0b0797b69db254c586f493872352f5a022b4d8479a00fc92ec55f9ad46a27e@88.99.70.182:30303&quot;,</pre><pre>}</pre><p>2. Our node tries to connect to bootnodes, but get response only from two of them</p><p><strong>Bootnode — 94.237.53.114</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T0P4g2b64Z7r7X-n" /></figure><p>The PING and FindNode UDP requests end up with ICMP Destination Unreachable responses. The router/proxy clearly is blocking this traffic. The TCP SYN requests over the port 30303 are also getting reset by the proxy.</p><p><strong>Bootnode — 51.141.78.53</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zt1q1ht-tzCOez5u" /></figure><p>All TCP SYNs are getting dropped somewhere in the n/w. Our node keeps retransmitting the SYN packets with no luck</p><p><strong>Bootnode — 13.93.54.137</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_zxg7lshKvy-ErqB" /></figure><p>No response to the Devp2p’s PING and FindNode UDP requests. The router/proxy clearly is blocking this traffic. All TCP SYNs are also getting dropped somewhere in the n/w. Moving on.</p><p><strong>Bootnodes — 3.11.147.67</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7FWq6dI7Uwyi0d1A" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gsPv-wxZadtHZMM6" /></figure><p>Clearly, same issue.</p><p><strong>Bootnodes — 18.218.250.66 and 88.99.70.182</strong></p><p>Finally, we are able to see how our node was able to connect to the peers in the n/w.</p><p>start client → connect to bootnode (Ping/Pong ) → bond to bootnode (Ping/Pong) → find neighbours (FindNode) → bond to nieghbors</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gYJxEZxrqepbKp-G" /></figure><p>The client (geth) will keep searching for nodes by following the same mechanism (connect/bond/find_neighbors) until all outgoing peer slots are filled.</p><p>Note</p><ul><li>The number of these slots is calculated using this formul: <em>maxpeers * dialRatio. The </em>default values of maxpeers and dial ratio are 25 and 1⁄3 respectively.</li><li>When the desired number of peers is reached, geth will stop looking. However, there will still be discovery traffic. This is because the discovery system requires maintenance to stay working. Also, the node can also lose a peer connection, and then that slot needs to be refilled. For more details about the specific values around slots and timeouts, check out the go code <a href="https://github.com/ethereum/go-ethereum/blob/master/p2p/server.go#L50">here</a></li></ul><p>Now, let’s go further. What exactly gets exchanged in the discovery process?</p><p>Let’s take a working example. Our node was able to identify a list of neighbors from the bootnode (as seen in the last screenshots above). Now, it is trying to bond to one of the neighbors (143.244.60.51) and get another list of neighbors (It keeps iterating until hits max peers)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nIa60ixyKxNEQ26X" /></figure><p>Zooming into the payload &amp; fields</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XDuQSi8lmIJ7xpe2" /></figure><ul><li>^ We can clearly see that a PING was sent from our node 10.128.0.20 to the bootnode 143.244.60.51. This PING includes hashed information about the new node, the bootnode and an expiry time-stamp</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IeuqyJZJlhlsX0EZ" /></figure><ul><li>^ A PONG was sent back by the bootnode 143.244.60.51 to our node 10.128.0.20 containing the PING hash (6cf6d111948bbe5e212ebc9401c7936b3b2df53e7699b1ddf9830c460affd70e)</li></ul><p>Since the PING and PONG hashes have matched, the connection between our node and peer is verified and they are said to have “bonded”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tIsb_SWsrH8ULZNu" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MWqI83W3MOSotc-h" /></figure><p>^ Once bonded, our node sends a FIND-NODE request to 143.244.60.51. The data returned by 143.244.60.51 includes a list of peers that our node can further connect to. The data is truncated into two UDP packets. One contains 14 neighbors and the other contains four.</p><p>Now, our node begins a PING-PONG exchange with each of them. Successful PING-PONGs bond our node with its neighbors, enabling message exchange. Again, this happens until the maxpeer*dial_ratio limit is reached. Also, if one of these neighbors goes offline, the peer slot needs to be filled up. So the process is repeated all over again.</p><p>The client then starts initiating TCP connections over the port 30303 with the corresponding nodes and exchange state information. More about this and the node addressing scheme to exchange data in a later post.</p><p>Coming back to discovery now, there are some unanswered questions</p><ul><li>Why is geth trying to connect to nodes by sending FIND_NODE and initiating stale TCP connections when clearly it hasn’t gotten any response for the initial ping. Does this not make the n/w unnecessarily chatty?</li><li>The UDP packets seem to be more than 1000 bytes. I got to know that there’s a fixed limit of 1280 bytes maximum packet size, and it has been working OK so far in all tested networks. However, a lot of legacy routers on the Internet still don’t handle bigger UDP packets so well. Usually, the safest option is 512 bytes. Modern routers, however, can handle bigger packets.</li></ul><p>Finally, the interesting part — this is not all of it. There’s another parallel DNS based discovery process that the Eth client carries out based on <a href="https://eips.ethereum.org/EIPS/eip-1459">EIP-1459</a>. This is a backup discovery mechanism that the clients can leverage especially during restrictive network policies that might fail the discv4 based node and prevent the nodes from joining the DHT. More about this and Ethereum Node Addressing scheme (ENR) in a separate post.</p><blockquote>New to trading? Try <a href="https://medium.com/coinmonks/crypto-trading-bot-c2ffce8acb2a">crypto trading bots</a> or <a href="https://medium.com/coinmonks/top-10-crypto-copy-trading-platforms-for-beginners-d0c37c7d698c">copy trading</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b3f7895f83f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/dissecting-the-ethereum-networking-stack-node-discovery-4b3f7895f83f">Dissecting the Ethereum Networking Stack: Node Discovery</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Just in Time Video Packaging on GCP using Kaltura’s Nginx Module]]></title>
            <link>https://medium.com/@saibalaji4/just-in-time-video-packaging-on-gcp-using-kalturas-nginx-module-2ac40ab9a36b?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ac40ab9a36b</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[ott]]></category>
            <category><![CDATA[video-streaming-online]]></category>
            <category><![CDATA[video-transcoding]]></category>
            <category><![CDATA[kaltura]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Thu, 06 Aug 2020 18:05:04 GMT</pubDate>
            <atom:updated>2020-08-06T18:30:03.569Z</atom:updated>
            <content:encoded><![CDATA[<p>In the <a href="https://medium.com/@saibalaji4/build-your-own-highly-scalable-h-264-transcoder-on-gcp-e2834acf1535">last post</a>, we discussed the various cloud native ways of building and running your VOD transcoding workflow. In this post, we will talk about why separating the encoding and packaging workflows is a good practice for VOD delivery.</p><p>In today’s world, every streaming platform needs to support multiple playout formats. This is largely because of the number of different playout devices and custom specifications for playing videos.</p><p>To deliver content to the end user in the most compatible format, we do two things: A) <em>Encoding </em>— To reduce the overall video size using some popular codecs like H.264, H.265 and VP9; B) <em>Packaging </em>— Covert the encoded video assert into a consumable streaming format like HLS or DASH and also enable DRM</p><p><strong>Traditional Approach</strong></p><pre>1. Encode and pre-package each ABR format (HLS and DASH) separately across multiple renditions</pre><pre>2. Upload all the files to an Object Storage like GCS or some origin server for delivery</pre><pre>3. Pay a licensing fee for the number of ABR output formats</pre><pre>4. Pay an infra/storage fee for the additional storage consumed</pre><p><strong>Dynamic Packaging Approach</strong></p><p>With dynamic package a.k.a<em> just in time packaging </em>a.k.a<em> on the fly packaging</em>, you go by this thumb rule — Encode Once, Package on the fly.</p><ol><li>Encoding — Encode your source content across multiple renditions and upload it to a source location (E.g. Google Cloud Storage)</li><li>Dynamic Packaging — Detect the playback capabilities of the client and dynamically generate the necessary ABR format. For e.g. For a HLS client, generate the necessary .m3u8 and ts files</li></ol><p>In this article, we’ll make a case for the following</p><blockquote>With dynamic packaging, you can significantly reduce net encoding and storage costs and also save a lot of time from re-encoding and re-packaging your existing content library to support newer formats</blockquote><h4>How does this work?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pECT3kpuOJQzPiDWh3mf7A.png" /></figure><p>Before we get into the details of the architecture, let’s take a moment to thank and appreciate the ever amazing open source community. Their contribution to the video streaming space is extremely valuable. In no specific order,</p><p><em>Kaltura’s nginx vod module </em>— Enables On-the-fly repackaging of MP4 files to DASH, HDS, HLS, MSS. There are several other features like DRM, multi-bitrate , subtitles etc. supported by this module</p><p>Fluent-ffmpeg Nodejs module — This library abstracts the complex command-line usage of ffmpeg into a fluent, easy to use node.js module. Ensure you have ffmpeg and all other necessary encoding libraries like libmp3lame, libx264 etc. installed in your machine or docker container.</p><p>Now, back to the architecture. Here’s what the flow looks like</p><ol><li>Encode your mezzanine video files using the nodejs-ffmpeg encoder on Google App Engine</li><li>Store the encoded assets in a GCS bucket location</li><li>Configure your nginx-vod-module to fetch the video files from this location dynamically for HLS and DASH</li><li>Dockerize your nginx-vod-module and deploy it on App Engine</li><li>Set the App Engine URL endpoint as the origin for Cloud CDN</li><li>Test Playback from a player of your choice — VLC, Safari, Bitmovin Player etc.</li></ol><h4>GitHub Repo Link for the Encoder Engine</h4><p><a href="https://github.com/saibalaji4/diy-nodejs-encoder">saibalaji4/diy-nodejs-encoder</a></p><h4>GitHub Repo Link for the basic dynamic packaging module</h4><p><a href="https://github.com/saibalaji4/diy-jit-packager">saibalaji4/diy-jit-packager</a></p><p><strong>Performance considerations</strong></p><ul><li>Packaging is basically a function of changing the container format and possibly adding DRM. This is usually a lightweight operation</li><li>When it comes to massive streaming in the order of several million requests (think live sports), we may run into scaling/performance issues</li><li>Dynamic packaging is usually a good fit for several thousands simultaneous users. With cloud native ancillary solutions like containers and Kubernetes, this can be further scaled in several orders of magnitude</li></ul><h4>Choosing the right solution strategy</h4><p>There are solution approaches to do dynamic packaging and Open Source is not the only way or always the best approach. Depending upon your comfort level and engineering appetite, you can go with one of the below options</p><p><strong><em>Vendor — SaaS based packaging solution</em></strong></p><ul><li>The infrastructure and platform elements are completely abstracted from the user and managed by the vendor</li><li>Usually comes with a portal where you configure the packaging settings</li><li>Mark up costs — Usually bundles infrastructure and storage with the packaging service costs</li></ul><blockquote>Net Cost = SaaS Bundle Cost + Support/ Services Cost</blockquote><p><strong><em>Vendor — License based packaging solution</em></strong></p><ul><li>The vendor provides the software as a deployable SDK that can be deployed on any hosting platform — Cloud, on-prem etc.</li><li>Some vendors support a cloud native deployment model — container, kubernetes etc. on top of VM based deployment model</li></ul><blockquote>Net Cost = License cost + Infra/Storage cost + Support/Services cost</blockquote><p><strong><em>Open source packaging solution</em></strong></p><ul><li>E.g. Kaltura’s nginx based vod packaging module (The one we discussed in detail in the previous sections)</li><li>Build your own packaging engine using nginx and open source packaging modules</li><li>Run it anywhere — Cloud VMs, containers, kubernetes etc.</li></ul><blockquote>Net Cost = Infra/Storage cost</blockquote><p>Regardless of the kind of solution you go with, dynamic packaging will naturally lead to substantial storage savings. The more compelling reason — It will make your video delivery architecture much more flexible and future proof. Need to introduce CMAF? No need to re-encode your entire library.</p><p>In the next few posts, we will be exploring DRM, SSAI, and CDN analytics. Stay tuned and Stay Safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ac40ab9a36b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build your own highly scalable H.264 Transcoder on GCP]]></title>
            <link>https://medium.com/@saibalaji4/build-your-own-highly-scalable-h-264-transcoder-on-gcp-e2834acf1535?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2834acf1535</guid>
            <category><![CDATA[app-engine]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[ffmpeg]]></category>
            <category><![CDATA[video-transcoding]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 10:54:09 GMT</pubDate>
            <atom:updated>2020-07-21T11:08:15.228Z</atom:updated>
            <content:encoded><![CDATA[<p>In the last post, we talked about building an event driven workflow for a basic transcoding use case (mp4 to webm conversion). Today, we are going to implement a h.264 transcoder which will package media content for online streaming such as DASH and HLS.</p><p>We will be following the same design principles and using the server-less watch folder based workflow as discussed in my<a href="https://medium.com/@saibalaji4/event-driven-video-transcoding-using-google-app-engine-cloud-pubsub-and-cloud-data-store-935de1492f35"> previous post</a>.</p><p>Quick snapshot of the design considerations</p><pre><strong>Decoupled processes</strong> Transcoding jobs are independent stand alone processes, so we can run them in a stateless manner</pre><pre><strong>Compute intensive </strong>Transcoding is inherently CPU intensive, but we want to auto scale to fulfil dynamic demands</pre><pre><strong>Zero configuration </strong>When we are building our own solution, the last thing we want is more grunt work</pre><pre><strong>Pay for what you use</strong> Cannot afford to over provision CPU resources for peak</pre><p>We will be also be using the same components such as Cloud Functions, Cloud PubSub, Cloud Storage, Cloud Data Store and App Engine for packaging media as well.</p><p>The only difference in this workflow is we will be using FFMPEG for h.264 media packaging with the help of python-ffmpeg-video-streaming package</p><p><a href="https://github.com/saibalaji4/diy-gcp-h264-transcoding">saibalaji4/diy-gcp-h264-transcoding</a></p><p><strong>Architecture</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-JN-D7Z7BQ4Q05wJeUz4g.png" /></figure><p>So what is happening here?</p><ul><li>The source video asset is passed through a packager engine using a watch folder based automated workflow</li><li>The packager engine, built in Python with the ffmpeg-video-streaming package, is run on top of a docker container</li><li>The app packages the media and generates the necessary video segments (.ts and m4s files) and the manifest files (.m3u8 and .mpd) across eight different preset configurations (code excerpt and preset config list below)</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2810c6cb8ae3b469aaeb0756f1933b12/href">https://medium.com/media/2810c6cb8ae3b469aaeb0756f1933b12/href</a></iframe><pre>_144p = Representation(Size(256, 144), Bitrate(95 * 1024, 64 * 1024))</pre><pre>_240p = Representation(Size(426, 240), Bitrate(150 * 1024, 94 * 1024))</pre><pre>_360p = Representation(Size(640, 360), Bitrate(276 * 1024, 128 * 1024))</pre><pre>_480p = Representation(Size(854, 480), Bitrate(750 * 1024, 192 * 1024))</pre><pre>_720p = Representation(Size(1280, 720), Bitrate(2048 * 1024, 320 * 1024))</pre><pre>_1080p = Representation(Size(1920, 1080), Bitrate(4096 * 1024, 320 * 1024))</pre><pre>_2k = Representation(Size(2560, 1440), Bitrate(6144 * 1024, 320 * 1024))</pre><pre>_4k = Representation(Size(3840, 2160), Bitrate(17408 * 1024, 320 * 1024))</pre><ul><li>The container is deployed to App Engine which scales the no. of container instances in and out to fulfil the load demands. Try uploading multiple files at the same time and see how App Engine scales in and out using the inputgenerator.py script</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECsHA_G2W0XQXw_i00PycA.png" /></figure><ul><li>Once the jobs are completed and uploads to Google Cloud Storage are successful, the DataStore is updated with the asset name, status, HLS Manifest Location, DASH Manifest location, job submitted time, job completion time</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecnQp5SBFDj9Kvzz9bRfWg.png" /></figure><p>In the next post, we will see how we can create a dashboard for tracking the live status of this transcoding with a progress bar view. We will also be covering topics like thumbnail generation, CMS integration and Google Cloud CDN for delivery in the next few posts. Until then, stay tuned and stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2834acf1535" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event driven video transcoding using Google App Engine, Cloud PubSub and Cloud Data Store]]></title>
            <link>https://medium.com/@saibalaji4/event-driven-video-transcoding-using-google-app-engine-cloud-pubsub-and-cloud-data-store-935de1492f35?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/935de1492f35</guid>
            <category><![CDATA[app-engine]]></category>
            <category><![CDATA[google-pubsub]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[ott]]></category>
            <category><![CDATA[video-transcoding]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Fri, 17 Jul 2020 18:25:41 GMT</pubDate>
            <atom:updated>2020-07-22T10:56:15.312Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Quick background </strong>— We are exploring some alternative methods, techniques and technologies to see what it takes to build and own your video solutions for your OTT platform. If you have not checked out my <a href="https://medium.com/@saibalaji4/do-it-yourself-video-solutions-on-google-cloud-884836c0faf8">previous post</a>, this will be the perfect time. If you already have checked it out, dive right in!</p><h4><strong>The idea of this post is to help you</strong></h4><ul><li>Set up an event driven transcoding workflow for your VOD assets</li><li>Run transcoding jobs in a decoupled and distributed fashion using Docker</li><li>Auto scale your transcoding jobs with zero operational overhead using App Engine</li><li>Track and update the status of the transcoding jobs with a NoSQL database backend</li></ul><h4><strong>Components Involved and Design Considerations</strong></h4><p>On a high level, a VOD transcoding workflow typically encompasses the following five major components</p><pre><strong>Storage </strong>A highly available and durable storage medium with robust API access</pre><pre><strong>Transcoder</strong> A robust transcoding engine that can be run in a distributed fashion</pre><pre><strong>Infrastructure </strong>A highly scalable unit infra like a container</pre><pre><strong>Notifications </strong>An event driven service with notification and job queuing capabilities</pre><pre><strong>Database </strong>A data store that can track and record the status of transcoding jobs and extend your CMS capabilities</pre><p>How do we put this all together and run a highly scalable distributed transcoding workflow with minimal overhead?</p><p>Let’s first lay out our design considerations</p><pre><strong>Decoupled processes</strong> Transcoding jobs are independent stand alone processes, so we can run them in a stateless manner</pre><pre><strong>Compute intensive </strong>Transcoding is inherently CPU intensive, but we want to auto scale to fulfil dynamic demands</pre><pre><strong>Zero configuration </strong>When we are building our own solution, the last thing we want is more grunt work</pre><pre><strong>Pay for what you use</strong> Cannot afford to over provision CPU resources for peak</pre><p>So we have the moving parts identified and our design choices laid out. With all this in place, let’s define our problem statement.</p><blockquote>We want to design an event-driven transcoding workflow with flexible scaling and minimal operational touch points.</blockquote><p>Good. Now let’s look at an architecture diagram for our app workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iAUwMx70Y1wvIuTRWy8NNw.png" /></figure><p>As you can tell, there are several steps in the workflow:</p><pre>1. Start off with uploading files to a storage medium</pre><pre>2. Notify the app waiting to run the job about the file upload</pre><pre>3. Kick start the transcoding job upon notifying the worker job</pre><pre>4. Transfer the output file to a destination storage medium</pre><p>What will the architecture look like on Google Cloud? Let’s take a look.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ONvRotc6k1x4pSLW9ituw.png" /></figure><ol><li>User/Script uploads a video to the watch folder input bucket in GCS. Only files added to this bucket will trigger the workflow</li><li>The “GCS create and finalise” event triggers the Cloud Function that runs the a python script.</li><li>Cloud functions invokes the python script, collects the uploaded video’s metadata (name, in this case), publishes a message to a PubSub topic</li><li>The worker application pulls the messages from the queue, downloads the source mp4 video and begins the transcoding job</li><li>The worker application updates the Cloud Data Store entity with ‘Initialising’ as the transcoding status</li><li>Once the transcoding job is completed, the output .webm file is uploaded to another GCS bucket</li><li>After successful upload, the worker application updates the status of the transcoding job to “Success” along with the GCS output file URL</li></ol><h3><strong>But why containers and cloud?</strong></h3><p><strong><em>Containers</em></strong> — Containers are lightweight, stand-alone, executable packages of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, and settings. This includes libav/ffmpeg as well. Running transcoding jobs on containers makes the whole workflow nimble. It’s right at the sweet spot where you don’t need to manage VMs and also have the option of porting it seamlessly elsewhere in the future.</p><p><strong><em>Cloud Functions </em></strong>— You need a server-less execution environment for connecting different services based on certain event triggers. E.g. Storage and PubSub. Moreover, it’s a fully managed service. Zero operational overhead.</p><p><strong><em>Cloud PubSub</em></strong><em> </em>— Since we are dealing with long running transcoding jobs, there needs to be a mechanism to decouple the job request and the job itself. Cloud PubSub is a messaging service for exchanging event data among applications and services helps us achieve this by decoupling senders and receivers. It allows us to set up a highly available channel between independent events/applications.</p><p><strong><em>App Engine </em></strong>— One of the challenges or running your application on a Platform as a Service is the restrictive nature of sandbox environments. With App Engine Flex, it’s more docker centric. This means that it’s easy to create custom runtimes for scenarios where you may want to run a library like ffmpeg or libav. Moreover, it takes care of spinning up instances and load balancers with auto-scaling capabilities for your app.</p><p><strong><em>Libav</em></strong><em> </em>— Provides cross-platform tools and libraries to convert, manipulate and stream a wide range of multimedia formats and protocols. In this example, we will be converting files from mp4 to webm format.</p><h3>Code Walkthrough and Deployment</h3><p>You can find the entire code from the Github repo below</p><p><a href="https://github.com/saibalaji4/diy-gcp-transcoding">saibalaji4/diy-gcp-transcoding</a></p><p><strong><em>Pre-requisites</em></strong></p><ol><li>Google Cloud Account</li><li>Create a Service Account with necessary GCS, PubSub, App Engine and Data Store access permissions. Refer to this <a href="https://cloud.google.com/iam/docs/creating-managing-service-accounts">doc</a></li><li>Create a PubSub Topic and Subscription beforehand. You will need the topic and subscription names to be mentioned under appropriate placeholders in the code. Refer to this <a href="https://cloud.google.com/pubsub/docs/quickstart-console">doc</a></li><li>Create a new Datastore entity under the default namespace. Name the Kind as ‘Transcoding’ and add four properties — category, status, Video Name and Location. These properties will be dynamically updated for every job entry by the worker application in the beginning and end of every transcoding job. Refer to this <a href="https://cloud.google.com/datastore/docs/quickstart">doc</a> for detailed set up instructions</li></ol><p><strong>Steps to deploy</strong></p><p>Create a Google Cloud project from Cloud Shell</p><pre>gcloud init &lt;your-project-id&gt;</pre><p>Mention your project, topic name, subscription name, gcs bucket details under the corresponding place holders in worker.py, then</p><pre>gcloud app deploy worker.yaml</pre><p>App Engine takes a few minutes to build and deploy the app. Once it’s deployed successfully, go to Services under App Engine and click ‘Versions’. You will see something like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w6QZTsoTq8S6wINb1pHuGw.png" /></figure><p>Ah! So App Engine is ready with two active instances.</p><p><strong><em>Unit Test </em></strong>Time to upload a single mp4 file to the source bucket destination and test the workflow. You may use gsutil or even manually upload a mp4 file to your source bucket from the console. I uploaded four 30s mp4 files, which took about a minute each to be converted and uploaded to the output GCS location.</p><p>Check the Entities page under the Kind ‘Transcoding’ in the Datastore console. You should see the jobs, status and output location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_27-ASV62K1U_nZ9hRVng.png" /></figure><p>Voila! That’s it. Wait a minute, we need to watch it scale.</p><p><strong><em>Scale test</em></strong></p><p>We will upload multiple video files to the source bucket using a script. To do this, we will run a python script that generates this load.</p><p><em>Note</em>: In the following script, I’m copying a file from a random bucket, renaming the file and uploading the duplicates to the source bucket which will trigger the entire workflow. Also, you can increase or decrease the no. of files to upload by simply changing the for loop range.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d7310f3bd3536cbed300b6fed549332/href">https://medium.com/media/2d7310f3bd3536cbed300b6fed549332/href</a></iframe><p>You will see that App Engine automatically scales out by spinning new VM instances in the background as you increase the load.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECsHA_G2W0XQXw_i00PycA.png" /></figure><p>You can also set max_instances in the app.yaml file to ensure you are within your cloud budget. After you run this load test, the app downscales.</p><p>For the ones who are looking for an even deeper dive into the code, you can check out the next section. For the rest, there you go! We managed to deploy an event driven, highly scalable transcoding workflow in a matter of minutes.</p><p><em>What we did</em></p><ul><li>Set up an event driven transcoding workflow for your VOD assets</li><li>Ran transcoding jobs in a decoupled and distributed fashion using Docker</li><li>Auto scaled transcoding jobs with zero operational overhead using App Engine</li><li>Tracked and updated the status of the transcoding jobs with a NoSQL database backend</li></ul><p>In the <a href="https://medium.com/@saibalaji4/build-your-own-highly-scalable-h-264-transcoder-on-gcp-e2834acf1535">next post</a>, we will try to implement specific video codec presets using ffmpeg and generate manifest files for HLS and DASH as well. Until then, stay tuned and stay safe!</p><p><strong>*** Code excerpts and detailed walkthrough below **</strong></p><p><em>Intercept the file upload event, extract the video file metadata and publish it to a PubSub topic</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9a9af6dfb1fb8d15b771b0840313de8/href">https://medium.com/media/b9a9af6dfb1fb8d15b771b0840313de8/href</a></iframe><p>Our worker application basically does the following five things</p><pre>1. Subscribes to a PubSub topic</pre><pre>2. Downloads the video file from the GCS bucket</pre><pre>3. Converts the video from mp4 to webm using libav</pre><pre>4. Updates the NoSQL database (Cloud Data Store) with the job status</pre><pre>5. Listens continuously for more messages</pre><p><em>Worker subscribing to the topic and listening for messages</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60f5a50aaddba9192d183fbc24a14639/href">https://medium.com/media/60f5a50aaddba9192d183fbc24a14639/href</a></iframe><p><em>Convert video file from mp4 to webm using libav and upload to GCS bucket</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d987191daced98e6ede0edfcb26d741/href">https://medium.com/media/2d987191daced98e6ede0edfcb26d741/href</a></iframe><p><em>Update the status of the transcoding job in a backend database</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ea301084b0127db45209ff6dfbb70b7/href">https://medium.com/media/5ea301084b0127db45209ff6dfbb70b7/href</a></iframe><p><em>DockerFile for worker application</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3dddc3c820a1f7d3a5bb9bc66abd9a01/href">https://medium.com/media/3dddc3c820a1f7d3a5bb9bc66abd9a01/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=935de1492f35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do It Yourself: Video Solutions on Google Cloud]]></title>
            <link>https://medium.com/@saibalaji4/do-it-yourself-video-solutions-on-google-cloud-884836c0faf8?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/884836c0faf8</guid>
            <category><![CDATA[ffmpeg]]></category>
            <category><![CDATA[ott]]></category>
            <category><![CDATA[streaming-video]]></category>
            <category><![CDATA[video-solutions]]></category>
            <category><![CDATA[transcoding]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Thu, 16 Jul 2020 19:39:56 GMT</pubDate>
            <atom:updated>2020-07-16T23:05:58.941Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgm1ws85G7KbZ0dUHgJymg.png" /></figure><p>If you are on this blog, you are either casually dabbling with the idea of building your own video solutions or seriously evaluating some practical options. Well, I won’t go as far as saying you have come to the right place, but this can be a good starting point for you. This is the first blog of a multi part series where we will be taking some baby steps into building a few OTT video workflow solutions on Google Cloud.</p><p>Now, the why.</p><p>I work with quite a few customers in the OTT space. Most of them seem to have this age old problem of striking the right balance between control, cost and operational excellence. This blog is an effort to evaluate these conditions and layout some hand-made solutions on Google Cloud.</p><p>Today’s existing managed video solutions come with a great plug and play formula. It’s simple and easy to start. For instance, there’s a whole gamut of software based transcoding solutions out in the market with flexible deployment models — on-premise or cloud. All someone needs to do is throw a bunch of source videos and wait to see them transformed in some output location. But not everybody goes with this kind of a formula.</p><p>Again, why?</p><p>To know why, we need to peel this onion further. So let us broadly (and boldly) classify customers in the OTT domain across these two categories</p><ol><li>Vendor Driven</li><li>Engineering Driven</li></ol><p><strong>The Vendor Driven OTT platform</strong></p><p>Most of the major media house giants and cash rich companies fall under this category. We can describe their operational model in as many words — “Take me to the market quickly, own your workflows and meet your SLAs”. Vendors have full control and choice with limited technical intervention from the customer. The main focus of this class of companies is Content. How do I buy or produce the right content? How do I promote the right content to the right users? How can I acquire and retain customers with new content?</p><blockquote><em>Content is King. And there’s no doubt about it</em></blockquote><p>However, even these companies are now increasingly giving more importance to the operational aspects of running an OTT platform. Having too much dependency on vendors and SIs is not only a commercially sustainable approach in the long run, but also stunts your growth from an innovation standpoint.</p><blockquote><em>“Can I experiment with the latest H.266 video codec to provide better video quality at higher compression ratio? No, sorry. It’s still on the roadmap”. The harsh reality is your innovation is now tightly coupled with the product cycle of a third party vendor</em></blockquote><p>To give credit where it’s due, this may be a great strategy when you are going to the market with a bang and hoping to cover a wider audience in a shorter period of time. This usually involves smaller teams and lesser engineering investments. However, the fact is at some point your monthly invoices will start giving you sleepless nights, not to mention the growing engineering inertia and technical debt. All this has now become even more relevant in today’s COVID situation where traffic volumes are going over the roof on one hand and ad revenues dipping on the other.</p><p><strong>The Engineering Driven OTT platform</strong></p><p>This class of players have already seen a substantial amount of growth and acquired a sizeable user base. They may have started off with a vendor driven strategy for managing their content management systems, transcoding workflows, video QoE analytics etc, but usually have been quick to realise the importance of investing in engineering efforts for building in-house solutions.</p><blockquote><em>The mantra here is “Operational excellence and Cost”.</em></blockquote><p>One of the driving factors is their broader vision. The spectrum of reach of OTT platforms has broadened in the last few years. People who intend to play the longer game want to not only venture into new streams of revenue, but also build their own loyal community of users. So now all of a sudden, OTT video is not only about delivering the right content to users, but also about giving users a wholesome 360 degree experience.</p><blockquote><em>Let’s admit. It always feels great to order our favourite biryani from the nearest restaurant while watching a tense T20. All this without having to switch app screens.</em></blockquote><p>So these companies want to transform their OTT video platform into one large aggregate platform — social, merchandise, e-commerce , gaming and lifestyle.</p><p>Now, imagine someone pitching this idea to a CTO of a fairly new OTT platform. What do you think they will ask? You guessed it right. How do I first optimise my existing platform to improve business agility and reduce operational costs? With optimisation comes innovation and exploration. So this is all we will strive to openly discuss and deliberate in this series of blogs.</p><blockquote>To summarise, building and maintaining your own solutions at the right performance and cost ratios is a journey, not a destination in itself. We will always need strong support from the right partners, vendors and managed solutions. Identifying the right mix that works for you and aligns with your company’s vision is the trick here.</blockquote><p>The point of this multi-part series is to explore some alternative methods, techniques and technologies and see what it takes to build and own your solutions for your platform. And yes — In the course of this series, we will also try to do some TCO calculations to evaluate these DIY solutions from a commercial viability perspective.</p><p>In the next blog, we will explore the use case of running a basic transcoding workflow on Google Cloud leveraging containers, notification queues and Data store. Until then, stay tuned and stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=884836c0faf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Video Workflow Automation-1: A Serverless Watchfolder Workflow on GCP using Bitmovin APIs]]></title>
            <link>https://medium.com/@saibalaji4/video-workflow-automation-1-a-serverless-watchfolder-workflow-on-gcp-using-bitmovin-apis-a41f37608a01?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a41f37608a01</guid>
            <category><![CDATA[video-automation]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[video-workflow]]></category>
            <category><![CDATA[video-encoding]]></category>
            <category><![CDATA[bitmovin]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 16:43:58 GMT</pubDate>
            <atom:updated>2020-04-21T10:55:38.829Z</atom:updated>
            <content:encoded><![CDATA[<p>In my<a href="https://medium.com/@saibalaji4/running-bitmovin-encoding-on-gcp-488c83d1d31"> previous blog post</a>, we saw why and how we can run Bitmovin encoding jobs on GCP. We also saw how video file-based transcoding workflows on GCP can be set up using Bitmovin solutions to convert source media into output formats.</p><p>Once you start using Bitmovin on GCP to encode videos, the next step is naturally to build an automated workflow to process your content.</p><h3>Set up a Serverless watch-folder workflow</h3><p>In this example, I have created a serverless video transcoding watchfolder workflow solution using several GCP services including Google Cloud Storage (GCS), Google Compute Engine (GCE) and Google Cloud Functions.</p><p>Each video uploaded to GCS bucket input folder creates the following outputs:</p><ul><li>An MPEG-DASH and Apple HLS adaptive bitrate streams (both audio and video), for playout on multiple devices with different network bandwidth connections</li><li>Manifests files for both HLS and MPEG-DASH playback (.m3u8 and .mpd)</li></ul><h3><strong>Project Repository on GitHub for running Bitmovin on GCP (For the impatient!)</strong></h3><p>This <a href="https://github.com/saibalaji4/bitmovin-on-gcp-encode">repository</a> on GitHub contains code that can be run both standalone and in a serverless environment .There is also a companion tutorial in README.md for the pre-reqs and for creating this workflow step-by-step. It also contains architecture diagrams.</p><p><a href="https://github.com/saibalaji4/bitmovin-on-gcp-encode">saibalaji4/bitmovin-on-gcp-encode</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4ofxn2s2ex__VeoZ" /></figure><h3>Walkthrough of the workflow</h3><ol><li>User uploads a video to the watchfolder input bucket in GCS. Only files added to this bucket will trigger the workflow</li><li>The GCS create and finalize event triggers the Cloud Function that runs the encode.py python script</li><li>The python script calls the Bitmovin APIs to transcode the video into corresponding ts and mp4 segments</li><li>The Bitmovin APIs spin Google Compute Engine VMs (VMs and PVMs) to run the job</li><li>The video segments (ts and mp4) are stored in the configured GCS output bucket</li><li>When the encoding job finishes, it calls a webhook HTTP endpoint event which triggers another Google Cloud function</li><li>This second function calls Bitmovin APIs to create manifest files (.m3u8 and .mpd)</li><li>The Bitmovin APIs use the existing GCE instances to generate the manifest files</li><li>The manifest files are uploaded to the GCS output bucket</li></ol><p><em>Note</em>: The GCP infrastructure is completely managed by the Bitmovin APIs. The VMs are deleted automatically whenever the jobs are completed and there are no new pending jobs</p><h3>Use this workflow to use different encoding preset configurations</h3><p>In the main.py script under the vod-basic-encoder folder, you should see the following VOD preset configs. It’s easy to create outputs with other formats supported by Bitmovin . You can refer to this <a href="https://bitmovin.com/docs/encoding/articles/supported-input-and-output-formats">Bitmovin doc</a> for the supported formats, codecs and configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4o_7LP6T81DwSfXbkw77qQ.png" /></figure><p>And do check out the upcoming blog posts in this automation series. We’ll be adding thumbnails, sprites, DRM and CMS update.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a41f37608a01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Bitmovin encoding on GCP]]></title>
            <link>https://medium.com/@saibalaji4/running-bitmovin-encoding-on-gcp-488c83d1d31?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/488c83d1d31</guid>
            <category><![CDATA[video-streaming-service]]></category>
            <category><![CDATA[video-encoding]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[video-streaming-online]]></category>
            <category><![CDATA[bitmovin]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 16:24:42 GMT</pubDate>
            <atom:updated>2020-03-26T16:24:42.307Z</atom:updated>
            <content:encoded><![CDATA[<p>People who run video streaming platforms typically have four major concerns</p><blockquote>How do we get the content online faster?</blockquote><blockquote>How do we reduce my video transcoding costs while retaining the quality?</blockquote><blockquote>How do we reduce my CDN Egress bills?</blockquote><blockquote>How to simplify workflows and integrations?</blockquote><h3><em>Now, the problem</em></h3><p>Traditionally, transcoding solutions have required a lot of compute, memory and storage. Even then, most encoding services run far slower than real time. E.g. In my recent client interaction it came to our attention that their current encoding service takes more than an hour to transcode an hour long video. Now, we can’t really reduce the encoding time without increasing the CPU and memory resources. With the current se tit’s becoming increasingly hard to strike a balance.</p><h3><em>Why Bitmovin?</em></h3><p>Bitmovin is a cloud based encoding solution with a plethora of video encoding features and it’s battle-tested to take us to this promised land. It takes a video, splits it into chunks, and encodes segments simultaneously across multiple instances. With this approach, a video can be encoded with speeds of up to 100x real-time. It also offers several other features such as per title encoding, highly customisable encoder (e.g. You don’t need to re-transcode the entire video if you need to just add one more audio track of quality profile) and several others.</p><h3><em>Three flavours</em></h3><ol><li><em>Bitmovin SaaS offering </em>— Running your encode jobs using Bitmovin APIs where the infra and platform elements are completely abstracted from the end user. You just need to key in the Input and output bucket locations</li><li><em>Bitmovin Infrastructure for On-prem workloads </em>— Here, Bitmovin will be making use of your on-prem infra where they will be deploying their SDKs and run jobs inside containers on top of Kubernetes</li><li><em>Bitmovin Infrastructure for Public Cloud </em>— This is what we will be covering in detail in this post. In this case, Bitmovin deploys their SDK in the customer’s GCP environment. Bitmovin utilices the benefits of cloud’s elasticity and pay-for-what-you-use constructs.</li></ol><p>In all the three aforementioned approaches, the core Bitmovin APIs remain the same. It is the infrastructure or the ‘where to run’ which is different. In this post, we’re going to create Bitmovin Infrastructure on Google Cloud Platform.</p><h3><em>Why GCP?</em></h3><ul><li><em>Bidding-less Preemptible VMs: </em>Bitmovin leverages the elasticity and on-demand nature of Public cloud to provide speed and cost efficiency. With GCP’s PVMs, instances can last up to 24 hours but cost 80% less. More importantly, there’s no bidding involved. This means you don’t have to worry about what you will get. The prices are set</li><li><em>Fast VM provisioning time: </em>The VM start up time plays a key role in the process of transcoding workflow. Typically, there will be several jobs piped in the queue and the encoding speed is tightly coupled with faster provisioning of VMs. One of GCP’s biggest differentiators is it’s VM provisioning time</li></ul><h3><strong>Test Case</strong></h3><p>We’re going to ingest a 80 min video (.mov) into the Bitmovin on GCP workflow and calculate the time it takes to encode the video. Also, we’re going to stick with the following VOD preset configurations and see how long it takes for the encoding to complete in these conditions.</p><h3><strong>Project Repository on GitHub for running Bitmovin on GCP (for the impatient!)</strong></h3><p>This <a href="https://github.com/saibalaji4/bitmovin-on-gcp-encode">repository</a> on GitHub contains sample code depicted in the diagram below. There is also a companion tutorial in README.md for the pre-reqs and for creating this workflow step-by-step. It also contains architecture diagrams</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1M7_LKnZOcjojzpyeA5u5g.png" /></figure><h3><strong>Results</strong></h3><ul><li>Bitmovin was able to improve the encoding speed by 4x. The 1 hour 40 min video was encoded in 20 mins</li><li>One n1-standard-8 VM and 15 n1-standard-8 PVMs were spun up to complete this job</li><li>The encoding speed was 1382 fps</li><li>The total output size is 14.65 GB</li></ul><h3><strong>Bitmovin Dashboard</strong></h3><p>Bitmovin offers a ready-made dashboard to track and monitor the encoding jobs. It’s a comprehensive dashboard with a lot of useful information updated near real-time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XLyGqFVMWAF2EttM" /></figure><p>The four main stages of an encoding job — Queue, Download, Analysis and Encoding, for every job can also be viewed from the dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vYLP-HjaKDOZOIZu" /></figure><p>In the next blog, we will see how we can set up a workflow automation architecture using a server-less watch-folder method on GCP.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=488c83d1d31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BigQuery and DataStudio for understanding the State of the Web]]></title>
            <link>https://medium.com/@saibalaji4/bigquery-and-datastudio-for-understanding-the-state-of-the-web-c6224f3e60f5?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6224f3e60f5</guid>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[cdn]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Mon, 23 Sep 2019 10:52:56 GMT</pubDate>
            <atom:updated>2019-09-29T17:02:23.721Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, as part of a home project , I was looking to find some market intelligence on CDNs, Web traffic performance and user activity behaviour.</p><p>As it turns out, most of the market intelligence reports on CDNs and Web Traffic are either paid subscriptions or seem to be non-authentic (Do let me know if you find a good one though!). Incidentally, I bumped into this whole new world of HTTP Archive and Chrome User Experience Reports. These are publicly available datasets that give as many data points about the Web as possible. A classic DIY (Do It Yourself) case!</p><p>To start with, I wanted to answer some basic questions —</p><ol><li>What amount of web traffic in India directly hit the backend origin servers vs CDNs?</li><li>How many sites switch CDNs?</li></ol><p>In this post, I’ve addressed only #1 for the most part and #2 briefly. #2 may be covered in detail in my subsequent posts.</p><p><strong><em>So here’s what I used for my analysis</em></strong></p><ol><li><em>BigQuery: </em>Google’s cloud-based, serverless, highly scalable enterprise data warehouse</li><li><em>Data Source 1</em>: HTTP Archive (Public Dataset)</li><li><em>Data Source 2</em>: Chrome User Experience Report (Public Dataset)</li><li>Google Data Studio: To visualise the result set</li></ol><p><strong><em>Why BigQuery?</em></strong></p><ul><li><em>Set up your data warehouse in seconds</em>: BigQuery runs blazing-fast SQL queries on GBs to PBs of data</li><li><em>Scales seamlessly</em>: Using managed columnar storage and massively parallel execution. It’s important to note that BigQuery is a public implementation of Dremel, the service that handles Big Data every second of every day to provide services like Search, Gmail, YouTube and Google docs. Just to give you some perspective — Dremel can scan 35 billion rows without an Index in tens of seconds. That’s really huge!</li><li><em>Public datasets</em>: Makes it easy to join public or commercial datasets with your data (E.g. Chrome User Experience Report used in this example)</li><li><em>Integration with existing ETL tools</em> like Tableau, Data studio etc. to further accelerate your insights</li><li><em>Cost</em> — You get to pay only for the storage and compute resources you use!</li></ul><p><strong><em>Why BigQuery for this exercise?</em></strong></p><ol><li>Because the tables that we are going to query runs in several hundred GBs and have got about 10 million rows in total. I don’t need to rack up any new hardware or install specialised software to operate at this scale. BigQuery does all the heavy-lifting for me in the cloud. Also, you get to enrich your insights with stunning visualisations using Data Studio, which is available off the shelf in Google Cloud Platform</li><li>You get to understand the “State of the Web” by analysing publicly available datasets and this is exactly what we’re trying to do in this case</li></ol><p><strong><em>A couple of things about these datasets</em></strong></p><ol><li><em>Chrome-ux-report.country_in.201908</em>: This will help us pull out the top origins in a given country (India, in this case). The Chrome User Experience Report provides user experience metrics for how real-world Chrome users experience popular destinations on the web</li><li><em>httparchive:pages.2019_08_01 (Mobile and Desktop)</em>: HTTP Archive crawls the full list of desktop and mobile origins from Chrome User Experience Report. This will help us match the set of URLs we pull from the CruX dataset against a list of pages (URLs) and check if CDN is enabled or not for each page/URL.</li></ol><p><strong><em>Results — Donut Graph view</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PJEQ3dPMxwcftvsCfWzD7g.png" /></figure><p><strong><em>Inference from the analysis</em></strong></p><ul><li>Around 33% of the origins with user activity in August 2019 use a CDN</li><li>Around 1% have been switched between a direct origin and CDN/s</li></ul><p>Note —</p><ol><li>The data is skewed to sites that get visits from Chrome so some long-tail sites may be under-represented</li><li>The results are accurate as WebPage Test’s detection and may miss any CDNs it can’t identify, but it should be in the ballpark</li><li>I’ve been wrong before and it will probably happen again. You can look at all the raw data available and question all my assumptions. It will be cool to see what results you get</li></ol><p><strong><em>Standard SQL query that was used</em></strong></p><blockquote>SELECT COUNT(url) as num_pages, cdn<br>FROM(SELECT<br>url,<br>STRING_AGG(DISTINCT(CASE WHEN JSON_EXTRACT_SCALAR(payload,”$._base_page_cdn”) = ‘’ THEN “Direct Origin” WHEN JSON_EXTRACT_SCALAR(payload,”$._base_page_cdn”) = ‘null’ THEN “Direct Origin” WHEN JSON_EXTRACT_SCALAR(payload,”$._base_page_cdn”) iS NULL THEN “Direct Origin” ELSE “CDN Enabled” END), “ | “ order by CASE WHEN JSON_EXTRACT_SCALAR(payload,”$._base_page_cdn”) = ‘’ THEN “Direct Origin” WHEN JSON_EXTRACT_SCALAR(payload,”$._base_page_cdn”) = ‘null’ THEN “Direct Origin” WHEN JSON_EXTRACT_SCALAR(payload,”$._base_page_cdn”) iS NULL THEN “Direct Origin” ELSE “CDN Enabled” END<br>) as cdn<br>FROM<br>`httparchive.pages.2019_08_01_*`<br>JOIN<br>`chrome-ux-report.country_in.201908`<br>ON <br>CONCAT(origin, ‘/’) = url<br>GROUP BY<br>url)<br>GROUP BY<br>cdn<br>ORDER BY<br>num_pages DESC<br>LIMIT 50</blockquote><p><strong><em>Results — Tabular View</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*fIMdMIF98DrbWVLGkYzLCg.png" /></figure><p>That was neat. Going forward, it will be interesting to find out -</p><ol><li>Number of redirects to each of the top 100 websites?</li><li>Number of connections per website for the top 100 websites</li><li>What’s the form factor distribution like ? E.g. Mobile vs Desktop vs Tablet etc.</li><li>What’s the connection type distribution like across the top 100 websites?</li></ol><p>With the availability of public datasets like HTTP archive and Chrome User Experience and an analytics engine like BigQuery, the possibilities of exploration are endless. Stay tuned for more posts and insights!</p><p><strong>UPDATE#1</strong>:This post has been updated to cover only the analysis pertaining to the presence and coverage of CDNs broadly. The parts mentioning specific CDNs have been removed due to certain policy guidelines</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6224f3e60f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain — Making customers feel like true kings!]]></title>
            <link>https://medium.com/@saibalaji4/blockchain-making-customers-feel-like-true-kings-1a227a7588b9?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a227a7588b9</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[blockchain-application]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Wed, 17 Oct 2018 13:45:06 GMT</pubDate>
            <atom:updated>2018-10-17T13:45:06.443Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain — Making customers feel like true kings!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*pThh58yzGNblsnlh-9besA.png" /></figure><h3>Addressing the consumer experience</h3><p>You can’t run a business without customers. In today’s world of rapidly increasing customer demands, almost every business swears by the adage, “Customer is King”. Someone might argue saying, “Employee is king, not customer”. I’m not getting into that debate. Sorry!</p><p>This blog is about how businesses are struggling to make customers feel like kings. How can Blockchain make a difference in this area?</p><p>Every business has a few key functions that impact customer experience -</p><p>1. What process to follow to sell?</p><p>2. How we market to our customers?</p><p>3. How we share information with the customers?</p><p>4. How do we get feedback from the customer and iterate?</p><p>While all this is good, in the recent past, several episodes of customer privacy issues have surfaced up. The “Cabmridge Analytica” debacle is a classic example. In these times of uncertainty, a few key questions have to be addressed to revive the confidence of our customers -</p><p>1. How do we protect customer data?</p><p>2. How do we take the burden off the customers to show proof for inferior service, product quality or privacy breach?</p><p>3. How do we seamlessly incorporate and automate the consequences of non-compliance by a player?</p><p>Now these are the questions that Blockchain addresses in the customer experience segment. It’s a business agnostic technology which is driven primarily by the interests of the end consumers. Blockchain has enormous potential to improve customer experience especially in the areas where we need to -</p><p>1. Improve access for disadvantaged customers</p><p>2. Make business more accountable using and managing customer data</p><p>3. Increase data security</p><p>Let’s dive into a few important use-cases</p><h3>Payments — Decentralisation and tackling double-spending</h3><p>At Starbucks, you pay cash and the cashier confirms your payment. This is verified by a human. With digital currency, the verification mechanism is a little tricky. Person A can transfer $100 to Person B and still keep the value of 100 in their digital wallet. Bitcoin tackles this double-spending problem with the help of blockchain technology. It employs a confirmation mechanism and maintains a distributed, universal ledger.</p><p>Cryptocurrencies like bitcoin use blockchain to send money from one person to another. It’s a secure, transparent system that operations with no need for a central bank. Any two parties can transact without any need for a third party to track the transaction. The details of bitcoin and cryptocurrencies is outside the scope of this article.</p><p>If you’re interested in understanding the very basics of Bitcoin, you must read this post written by one of my favourite writers, James Altucher — <a href="https://medium.com/the-mission/everything-you-need-to-know-about-bitcoin-f2a3be247a5b">https://medium.com/the-mission/everything-you-need-to-know-about-bitcoin-f2a3be247a5b</a></p><h3>Supply Chain — A blameless postmortem and improved service quality</h3><p>With IoT, goods can now be tracked at each point of the supply chain. We can monitor the status of a package as it is moved from vendor A to vendor B and the payments at each transit. By recording all this information in blockchain, we can have a blameless postmortem when things go wrong.</p><p>No party needs to prove the delivery of a package in case of a loss or delay. The status of the transaction will be registered in a distributed ledger. This record is also tamper proof and a single source of truth. From an operations standpoint, this system also lays the foundation for proactive serviceability. We don’t have to wait for the customer to file a compliant for fixing issues in the backend.</p><h3>Legal and Contracts — Smart Contracts</h3><p>Blockchain can also enable contractual obligations tied to specific actions through an “if/then” model. In this way, we can check if a contractual condition has been met or not. This system not only digitises paper work, but also automates the consequences of contractual non-compliance.</p><p>E.g. A customer signs a contract with a gas agency. The gas agency agrees to have the service available by a specific date. This condition is held in a smart contract. Then, we put in place the following if/then model in the blockchain network and the consequences are taken care automatically in the background.</p><pre>If (the deadline is not met for service delivery) {</pre><pre>              initiate_advance_refund()</pre><pre>} <br>else if (service delivery happens on or before deadline) {</pre><pre>              complete_customer_payment()<br>}</pre><p>In today’s world, the real burden is often put on the shoulders of the customer. For e.g. Proof for poor service quality is often expected from the customer. Adding to the woes, third party intervention is usually need to verify the claims of contractual wrongdoings. Blockchain alleviates this problem with the help of these smart contracts.</p><h3>Record Keeping — Consumer Preference Records</h3><p>Customer data is increasingly getting sensitive. This could be PII, passwords, health records, sms preferences, political preferences etc.</p><p>There’s also a growing need to consolidate the disparate systems of records and maintain a single tamper-proof system.</p><p>A regulatory body of industry A may need to regulate the monetisation of consumer data, consumer privacy and taxation. In this use-case, Blockchain works hand in hand with the regulatory body. It enables consolidation, consistency and tamper-proof data recording.</p><p>E.g. A tele-marketer who’s a subscriber of ISP A wants to send an SMS to a subscriber of ISP B. If the records are shared with all the ISPs on a blockchain network, ISP A could prevent pesky calls and SMSs at the first hop itself.</p><p>This will save a lot of bandwidth and unnecessary backend calls. Any non-compliant vendor or tele-marketer could be easily tracked and penalised.</p><p>Penalising non-compliant players and transactions can also be automated using the smart contracts logic. Auditing exercises also become a straight-forward drill with the distributed ledger system.</p><p>In conclusion, I would like to highlight that Blockchain as a technology is here to also protect consumer interests and privacy. This is often overlooked. It has the potential to truly make customers feel like ‘kings’.</p><p>We’ll see more about the technicalities of Blockchain in the upcoming posts. The topics that you can expect -</p><p>1. Setting up an Enterprise Blockchain Network using the Hyperledger backbone</p><p>2. Writing a smart contract in Go lang for a system of consumer preference records</p><p>Thanks for reading. Happy block-chaining!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a227a7588b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Herd your IT cattle - Part 1]]></title>
            <link>https://medium.com/petsandcattle/herd-your-it-cattle-part-1-708896c6d111?source=rss-c90d3f8a26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/708896c6d111</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sai Balaji]]></dc:creator>
            <pubDate>Tue, 31 Jul 2018 07:28:54 GMT</pubDate>
            <atom:updated>2018-07-31T07:55:28.983Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Herd your IT cattle — Part 1</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sLcijMPZE0N2HGiCP6Aniw.png" /><figcaption>From being a pet owner to becoming a Herdsman</figcaption></figure><p>So we’ve finally got our own little golden retriever pup back home. Her name is Barfi. It has been a roller coaster of a month so far. Life is changing and changing rapidly with every passing day having its own adventure and mishaps. Being an IT-systems-guy-turned-Cloud-Architect and with an obvious and blatant intent to draw comparisons between my everyday life and the IT world, I was able to draw some uncanny similarities between treating our pets and our IT systems.</p><p><strong>Here are a few characteristics of Barfi</strong></p><p>· Needs continuous personal attention</p><p>· Wakes up at 6.30 AM sharp and wakes us up as well</p><p>· Plays only with specific toys (she doesn’t like all the toys)</p><p>· Responds only to handcrafted methods to control her temper, mood, and apetitie</p><p>· Potty training (of course!)</p><p>· Habituation with outside world (So that she doesn’t jump on you when visit my place)</p><p>Now, the important point here is that our neighbour’s dog is completely different. He is a Beagle and he’s much more demanding. He has his own schedule, routine, habits, liking for food, temper, and athletic, mental and emotional quotients. It’s true that no two pets are similar. The methods and techniques that we apply to control and pet Barfi don’t apply to Bruno, the Beagle.</p><p>So I can say that Barfi is a reasonably good dog. When I say good, I mean that she’s not too demanding. She behaves herself and she is doing well with her training activities. Bruno, on the other hand, is a dog that has got separation anxiety, temper and biting issues, and misbehaves quite a lot.</p><p>It turns out that my neighbour was living with a bunch of other flatmates and each of them had their own agenda for training and style of petting. Apparently, this got Bruno confused and has made him to be an un-trainable dog. A pet needs a single owner and training needs to be homogeneous and consistent. As a result of this problem, an expert dog-trainer has been hired by my neighbour now under the hope that it will eventually help Bruno behave himself. Fingers crossed!</p><p>The worst case scenario will be giving Bruno off to a shelter home, but I know that my neighbour is already emotionally invested in Bruno. This is going to be a tough call!</p><p>Now, I’m going to have to ask you to park your thought just there and shift your focus to the traditional way of running, operating and maintaining IT systems.</p><p><strong>The characteristics of a typical IT system</strong></p><p>· Needs continuous monitoring</p><p>· Needs specific bug fixes, software versions and other dependencies</p><p>· Handcrafted scripts and tools to fix issues as and when they arise (E.g. a script to restart the service when the memory utilization peaks on a particular machine)</p><p>· Has its own scheduled jobs, tasks and operations</p><p>· Continuous dumping of logs to an external storage</p><p>· Need to create specific rules and policies (E.g. Security rules for communication between a Web Server and App server, different subnets, Internet access etc.)</p><p>· Destroying an old or problematic server and getting a new server or VM is layered with a number of processes and has its own channels and teams. E.g. DB team, Middleware team, Front-end team, Infra team etc.</p><p><strong>When you treat your IT systems as pets</strong></p><p>When you treat your systems as pets, you are basically running manually built and changed systems. You are putting in a huge amount of work by handcrafting and attending to each server’s unique needs or issues. The resulting systems are special snowflakes that aren’t truly identical. The differences between test and production environments plague application quality. The unexpected and un-reviewed changes, just like the ‘un-reviewed’ training that Bruno was put through by my neighbours’ flatmates, have been proven to be the leading cause of downtime. The worst part being, you can’t give your server to a shelter home if it misbehaves frequently. Heavy investment!</p><p>So, the idea is simple — <strong>Stop treating your IT systems as PETS and start treating them as CATTLE!</strong></p><p>You do not have to handcraft them and cater to their unique needs. Rather, you mass produce them using a standard mechanism, kill them and get more!</p><p><strong>What does treating systems as cattle really mean?</strong></p><p>· Creating a model-driven system to create and operate your systems</p><p>· Treating your infrastructure like a piece of code. Just like fixing a code bug, you will change the code, build it, test it, and then deploy it</p><p>· Selecting the right set of tools to help you implement this system</p><p>In other words, you need “Infrastructure as Code”!</p><p><strong>General IaaC Misconceptions</strong></p><p>First things first, let’s put some of the common misconceptions away —</p><p>· You don’t need to learn Java to practise IaaC or do DevOps.</p><p>· You won’t be fired or don’t have to fire the Operations Team that take care of provisioning, maintaining and operating your infrastructure currently</p><p>· You don’t need to discard the existing automation that is already running. You just need to realise that these are code and we need to apply coding best practices to them E.g. shell scripts, Apache config files, build definitions or OS files.</p><p>· IaaC is not DevOps. It’s one of the practices of DevOps. We will see more about this part later</p><p>There are several number of ways to implement Infrastructure as Code. We will discuss the workflow, methodologies and tools available to implement IaaC in my next post (Part-2). Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=708896c6d111" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petsandcattle/herd-your-it-cattle-part-1-708896c6d111">Herd your IT cattle - Part 1</a> was originally published in <a href="https://medium.com/petsandcattle">Sai Balaji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>