Hey guys, we are recording and we are beginning to discuss the Netflix case discussion, Netflix discussion as you already know, Netflix as a company about 10 or so years ago, maybe more than that a little bit, maybe 15, I don't know when exactly don't know when that company used to be a company that, you know, rented DVDs. So you had this round shiny thing that used to exist. The thing was called DVD. You may have memories about it. These things don't exist, apparently don't exist these days. But there used to be a thing like this that used to come in a red colored envelope. You know, it used to come in mail. And you know, that was the business Netflix was in. So they used to send a package like this to you in the mail. And you know, they did that to everybody, whoever was a subscriber to Netflix. So basically, it was a DVD in the mail company. And the mail will arrive, you can probably subscribe to a plan in which you can have two DVD at a time, or maybe three, four, depending on how much money you pay them. And they will let you keep that many DVDs at a time in your home. And then you can watch them as many as many times as you like. That was the business that Netflix was originally when they started this thing. They actually started to compete with what was known as this dinosaur. The dinosaur was called, what was it called, Blockbuster. So Blockbuster was the primary competition for this business. Now these days, we don't even know what Blockbuster is. Basically there is one Blockbuster store still open in Alaska. I have no idea why it is open, but it's there, somebody told me the last time. That person was from Alaska and they seem to have a Blockbuster in Alaska, whatever. Basically that company is dead. They got killed effectively by Netflix. Even 10 years ago, they were dying. Even without the new Netflix that you know, that we know that is in the cloud, that Netflix, the new Netflix is not DVD. So the original business of Blockbuster was something that as you probably recall, I don't know many of you have used Blockbuster or not, but something that there's a comment chat that will see the chat, see what the chat is saying. There was a chat I saw and it disappeared. Hold on. There was a chat message. I don't know where it went. Where did it go? That was from me, Nilesh. Basically, I was saying that actually, I think just this year, the Alaska Blockbuster is closed and the only one left now is in Bend, Oregon. Okay. They still have one at least. Okay. That is awesome. But okay. Good to know. Good to know. Thank you. I don't have that Bend, Oregon information, but the point that we are trying to drive is that that company died. It died for a variety of reasons. And one of the most important reasons was, do you know what the most important reason why this company died? It was late fee. The problem with that company was that people were sick and tired of their late fee. And the problem in their business was that, you know, anytime a new movie comes in and so you have this new movie these days, what is it called, Alita. So imagine Alita is now on DVD, imagine it's not there yet. And so Alita comes on DVD. So the first thing Blockbuster would do is stock up Alita, like 20 copies of DVD in every store in the US. And then they'll give it out to you. You go to the store, you pay them a deposit, and then you take the movie out. You still pay them like five to six dollars or whatever rental. And then you keep it in your home for one extra day. One extra day, and you're hit with a late fee, $19. That was the problem that people used to hate. And what Netflix saw this as an opportunity, they said, you know what, late fee problem. We will not charge late fee, zero late fee. Keep as long as you want. And so you have a DVD in the mail, not just one, but two, or maybe four, depending on what plan you have. You keep the DVDs as long as you want, and we will charge no late fee at all. And that was the model. The model here was a slightly different way to handle that discussion, which is, I think we have a new student joining in. I let them person in, okay, so give me just a sec. I need to let that person in, and we have that new person is Cham. I will just send her a link so that she can join. She just chatted, and so I need to let her in. Please join a live session right now. Going on right now. Zoom link is here. This session will run 4 to 7 p.m. Pacific, 7 to 10 Eastern. The link is... What's the link? What's our meeting link? Hold on, I need to stop sharing, okay, in order to see the link. Or if you have a link, just paste it for me in Slack or somewhere. I'm giving you a link. Is that the link? Yes. Apparently, I have it in my buffer. When the meeting starts, here is the link. So she will join now. Okay, sorry about the interruption. The new person is coming in. Thank you. Thank you very much. I had that link copied in my buffer. As soon as the meeting starts, the meeting link gets copied over into CopyBuffer. So I had that link in my paste. So I just pasted it. Thank you. And so what I was talking about is this DVD in the mail discussion, which is what you're looking at is the point that Netflix really had was cut the late fee. Now, the problem that Netflix still had is that they could not get Alita or even slightly older movies because there was a difference in the way this company operated than this other company. And let's go see what the difference fundamentally was. In fact, Netflix was very, very savvy in bypassing and not stepping on the foot of this thing called Blockbuster in a very careful manner. What they did was they found out, how do you sidestep somebody? And so, hi, Chum, Chum just joined in, Chum, we are online, we are live and we are discussing the case study of a company called Netflix, Netflix, as you know, already that company, how does it run its cloud operations in the context of Amazon cloud, we are beginning to discuss the case study of Netflix as the company and comparing that with the older Netflix like, you know, there used to be a company called DVD in the mail. So that company is what I'm talking about right now. So we will soon switch the discussion to the modern Netflix as we know. Right now we are discussing comparing Blockbuster and Netflix as to how it eventually killed Blockbuster. That's the point. So welcome. You are, you know, okay to keep the microphones open and ask any question anytime. You can mute yourself if you like. If you get stuck, just ask a question in chat or in whatever form, Slack chat, this chat, that chat, any method is okay. Having said, we are talking about the possibility of how this company could, you know, there was a new company and Blockbuster was in the market. Now we had this new Netflix company, what they're trying to do is find a niche, a niche that they can establish themselves in. Now Blockbuster was the company that, you know, will give you access to the latest and the greatest movies of any time. The new latest movies pop up, Alita as a movie pops up, they will come out with a DVD and then will immediately become available in Blockbuster. Netflix could not do that. The problem was that you cannot afford to have each and every customer of yours access to the latest and the greatest movies because these movies, newer DVDs are expensive. You could not afford to do that. So that was the problem with Netflix. The problem with Best Buy was that they could not do something that these guys were able to do. And what these guys had was, it is called a long tail. If you know what a long tail is, it's an economics word, by the way, econ, economics word. Let's go search that word and see what it means. So I'm going to search it. And like usual, it's a Google search. So that will bring out a picture. So here is long tail, and that will tell us what long tail is. So here is a picture of the long tail, let's go look at it. And yeah, that's a good picture. That is what long tail actually looks like from an economics standpoint. Now here in the discussion around long tail is basically goes like this. You have the most popular DVDs right here, and the other movies all the way, older movies this way. And popularity, or rather I should say less popular. And this is more popular. So that's the selection. You have very, very fresh, latest, freshly available movies are very high in demand, very high popularity. The other movies, there can be like millions and millions of, you know, millions of movies out there, including, you know, not just Bollywood, sorry, not just Hollywood, but I'm adding all you adding Bollywood and Tollywood and Lollywood. And I'm not joking. These are actual names that people use in other countries to refer to what they have in their own industry where they make movies. So like Hollywood in Bombay, it is called Bollywood. In Tamil Nadu, it is called Tollywood and like, you know, Lahore, it's Lollywood and like that. So it's a play on the word that if you collectively see all the movies that people create in the world, it is probably millions and millions of movies. Not all these movies are popular, but some of them that are recently freshly introduced, they may be popular. And most of the movies are basically plain old boring. Some of them are really good and people watch them. People want to watch the popular ones. Now if you compare this idea with what we just were discussing with this company, they were able to store popular movies in their store locations, but they could not afford to carry the long tail. This entire long tail selection of movies available on the planet is really large. So millions and millions of movies. And they could carry only like a few, a handful, I should say handful, a handful of movies they were able to, so Blockbuster was able to carry only a handful. Netflix on the other hand, was able to carry millions of movies and millions of DVDs because they did not have a store. Just like, you know, just like, you know, there was no store location to go to in Netflix. There was only a website. In that website, you had a thing called a queue. In that queue, you had a priority order. I want to watch this movie and then I want to watch this movie and then that's your preference listing. So you had lists of movies that you will rank order and reorder and arrange them and things like that. And you will shuffle that and you maintain your priority queue. They will look at your queue and if that movie becomes available, they will mail it to you and then you keep it and you keep another one and you have two movies out to you. You watch them. You're done watching. You can take any number of days you like and then you return it. When you return it, this next movie will be sent to you for number three. If you return number two, you have one and three still. That was the game that Netflix were playing and they were able to carry a much longer selection of movies because they did not have to carry all these millions of movies in every store. Instead, they had only a certain number of locations. Imagine if this is the map of the US. And so let's go look at the map of the US here. And so from that perspective, Netflix would typically have something like a location I think they had in Renton. I don't know exactly. Maybe here, maybe here. It's only a few locations wherever you will have Netflix locations. I think I went to Mexico for some reason. But yeah, wherever the red dots are, they will have a location, a warehouse location where they will carry all the millions of DVDs. They could. And they will just rent it out to people who are asking from regional hubs and like that. The regions were demarcated and that's how they divided the nation in form of regions for their own usage. And they were able to store physical DVDs in these geographical distribution centers. And having seen this idea, Blockbuster could not actually carry that many movies, millions of them. They focused only on a handful. Now the problem with these handful movies, like the latest and the greatest, let's go see some name. I'm very bad with movies. I'm going to read the names of movies to make references. I'm going to just go to movies and to see some names of the movies because I have, yeah, so here is Cap. Are these names of movies or what? Probably. Yeah, I think these are names of movies. So here we have Captain Marvel, How to Train Your Dragon, Maria, Ali Tan, Lego and like that. So just a few movies. And Blockbuster will carry those latest movies in their store, but they could not afford to carry all the millions. And so you had a choice. You had to go to Netflix to get the DVD right because otherwise it's not available locally. That was a different market, slightly stale, slightly older, slightly less popular. But again, no late fee. That was the game. The problem with this kind of a model was that they were able to actually compete with Blockbuster because they played in a slightly different market, not the most popular movies, but slightly older. And they were able to cut late fee and they got themselves in the market. People started to use Netflix as a consequence. Now you have a queue, you maintain a queue and you will add your names to the queue and the movie becomes available. It becomes, it reaches your home and when you return this one. And so that becomes available. That's how the business started. The problem with this kind of a business was that you had the DVD and what people used to actually do is something very shady. And they had, they had this awareness of the problem that shady business is called DVD John. Let's go see what DVD John is. So this DVD John as a person, he created a software called DCSS. And what this software does is basically lets you copy the DVD, like completely copy by de-scramble, basically unscrambling. So the name of this software is D as in remove CSS, CSS is content scramble system. So every DVD that you see in, even today, you have a, sorry, you have a DVD and you try to put that in DVD player one, so play it here. And on the other one here, you try to record it. The recording will fail. It fails because of this, because this is copy protection, basically copy protection. And that's what Hollywood wants to protect their DVD because people were like, you know, you could copy potentially if you have a player and a recorder, recorder, you could just copy DVDs and that was happening because of this software. This software is open source and it is built into Linux. You have it there in your Linux machine. It is there as a part of Linux system. And problem with this software is that it is open. But since it is open source, people made utilities to make this pass. And that was a problem that was a major problem. It is still a problem for Hollywood, Bollywood, all the content creators. So whoever creates a content, they see that this is a problem if somebody just copies it over from one machine to the other and creates a replica of the DVD. And so that's what was happening. People were just, you know, taking a DVD and copy it. So you have a DVD, you bring it to your home, you get one, two, maybe three, four at a time DVDs and you just copy them and return them quickly. You still have copies, you keep them and then you have more, more videos, five, six, keep on coming. That was the problem. It is basically piracy. That was a big problem for Netflix. So they wanted to cut this game of piracy altogether. And that was one of the business motivations as to how and why we should do that. Because otherwise, you know, if you keep on letting this copying business happen and people will take your DVD, copy it, return it. It defeats the whole purpose of the business. So you want to cut this. How do you cut it? You have to basically cut this, you have to somehow find a way to let the user see the movie without actually giving it to them. That was the problem to solve. And now Netflix started creating these ideas about, you know, can we stream a movie? Stream a movie as opposed to download. If you know what this idea that I'm just mentioning, the difference between this and that, please tell me that you know. If you're slightly confused about this idea, say that and I'll explain what it means and what the difference is. And maybe I'll just describe a simple example. Let me show you an example here. For example, you are looking at say YouTube or rather I should say Vimeo. I should not go to YouTube because it might, you know, enter into copy protection issues and so I don't want to run into that. So I'll go to another site where I store my own videos, I can just do whatever I like with them. These are my videos. The video here. So this video I can play. See that it's playing. It is not downloading. It is playing. I'm going to stop it now. The point here is if you inspect the element of this HTML, you will find that it contains a player somewhere. Yeah, that's the player software. And it brings down pieces or chunks of the video at a time. So if you look at that exact video that I'm looking at right now, which is this last session that we did on March 4th. So if you go to that folder where I have the file stored in reality, I store it in somewhere here and here and somewhere in some location inside and in there. And that's where the actual file is, this file. Now that is locally available to me because I created it. That's my source. So this file is actually 817 MB file. Now that file is what you see here, streaming. It means it is, first of all, not downloading. It's not downloadable to you. I have it because I created it. But the only way I can download is to hit the download button, which is visible only to me. So I have prevented that download from this site. And so in fact, if you go to that site, you cannot even see the video. So I'm just showing it to you to illustrate a point in the difference between a download versus streaming. The concept is you will look at the file here, 817 MB, and you will create chunks, small little bits and pieces. And you stream them one or few portions at a time into a player. A player will look something like, let's see a player, a video player will be something like here. So you see they inspect the element, that's where you will find a player. And so there is this player class, which actually runs a video player that looks at that video. So on the very front page, you have this video, you can see the video, but it will not be able to download the video because there's no download function. The concept behind Under the Hood is like this. It goes like this. If you have a 817 MB video, you will probably divide that into, say, 817,000 pieces. I'm just roughly dividing it by that. So small little pieces, thousands of pieces. If you just make 1,000 pieces, divide by 1,000. So just whole file, divide by 1,000. What does it get you? You get 817 kilobytes sized pieces, about 1,000, I should say 1,024, yeah. That's a better math. So you get 817 KB chunk, these many chunks, these many. That's what you will receive. Now you can further divide it into a bigger number. And so this number will go down as a consequence if you grow that number up. That's the idea behind chunking or making small little bits and pieces. This is still a big chunk. A good chunk size is like 4 KB. So if I want to really get to the appropriate chunk size or the size of a digestible packet, this is probably a good size. So what I need to do is actually get 817, 1024 kilobytes of the total file that I have. I will divide that into 4 kilobytes. And so then I get something that that's the number of chunks I will have, these many chunks I will receive. And now I need to manage those chunks. So what I actually do is in a video player, which is a player software that you can use something like here, where is the player? I had it open as an example. And it disappeared on me. Hold on. It has to be there. Google Chrome. Yeah, there is a player. So here's a VideoJS player of a video that I will be giving you a short demonstration just now. So just stand by for it. And I need to get it to activate so that you will understand what is the idea behind a video streaming versus a straight up download. A straight up download is basically you go to the site and say click the download button and you choose the size of the original file and you download it and the whole thing is getting downloaded. The whole package will become available soon here in my local downloads folder. That's not what we are really doing when you go to Vimeo or YouTube or other places like Netflix. I will not be going to Netflix to play a video because it will be copyright violation. So I will not be doing that. But I will go to the video site, Netflix site and show you what goes on. That we can do. So we will do that. But I will not be playing any videos on that site because it gets into troubled areas. I am not doing that. Having said back to here, a distinction between a download and a stream is that you are handling only a small portion of the video at a time. Not the whole 807 MB. This is like a three hour video. This whole file. This is a three hour session. So we are not talking about that full download but only a chunk of the whole timeline. So you get this chunk and that chunk and that chunk. And so you will play. And this is your playhead traveling along and you will receive these chunks when your playhead is there. And you will receive a few more chunks as your playhead goes forward. And then if you suddenly jump from here to here, then you will discard these plays. They will be discarded and you will be sent these chunks. And so those four chunks will come to your player and will play the video from that point onwards because you just seek into the video in that time frame. So this is the idea behind streaming versus the idea behind download is you get the whole file here. So like I just downloaded apparently. So you have the whole file and it's still downloading. See it is not. Yeah, it's still going on. The download is still going on. I'm going to break it. It's kind of pointless. So I'm not downloading it. But the idea is that you can download if the service provider lets you. Now Netflix doesn't want you to download. They want you to see it and not be able to download. That's the whole point behind streaming versus downloading. So Netflix doesn't allow you piracy or doesn't allow you to be able to copy. So they were able to actually circumvent that idea by getting across the concept of de-scrambling a content by using streaming as opposed to DVDs in the mail. So that was one of the business motivations behind these guys as well as Hollywood, Bollywood, Tollywood, Lollywood and other words. All the movie producers. They wanted them to get away from DVDs primarily. But then come this problem about we have millions of movies and we don't probably know how many millions they have. I have no idea. I'm just calling it millions. Now each of these millions of movies is basically think of it like a DVD. They have it somewhere. It's not actually in form of a DVD, it's probably in another file format. They keep it somewhere in their location. And now you want to let users all over the US get any DVD or any movie, I should say. Not a DVD. Get any movie anytime, any place, any movie, any device. That's the kind of demand people have when people are increasingly impatient about the movie watching experience. When they want it, I want it now. That's the kind of demand people have. So this is a customer. They expect that your movies will just work anytime, any place, any movie, any device. And I want it now. And like now means when I play the play button, the movie should play. I mean, that's the expectation. There is nothing, anything below that. Bad Netflix, bad YouTube. I don't like buffering. I don't like this. I don't like that. People complain. People's expectations have tremendously grown and they lost all the patience. And so that is the problem that Netflix has currently, even today. Now the way to solve this problem, they tried multiple different ways to solve this problem. One of them was, can we set up our own data center? Like should we have our own facilities, multiple places across the US and then we will stream it out to any person, anytime, any device, any location all over the US. That was one approach. The other approach was, let us not build a data center and let us not instead use a cloud. So we know that Netflix uses cloud, but what would you think of are the differences between building your own data center and putting all the equipment and all the infrastructure here and then do the same thing as opposed to, this is basically outsourcing. If you think about it, they have outsourced their business of building a data center to somebody else. In this example, they have given it to Amazon Web Services. That's where Netflix runs today. So we know that on the backend, they did not decide to have their own data center, but instead decided to use the Amazon cloud, outsourcing it to them. Now if you think carefully, what did they outsource? They outsourced their infrastructure, the building, the equipment, the cooling, the electricity, the network and all the maintenance updates, OS patches. All that maintenance was outsourced basically to this company. That is one of the fundamental things I think when I first discuss the idea behind cloud computing is what I describe these things is that you should stick to your core competence. So let's start thinking about what that means one more time. We have discussed this briefly before, but I'll just go back to here. The idea of core competence. So let's go briefly spend a few minutes on discussing that, just checking our clarity of thought on that idea about core competence and here it goes. So what is the core competence of say your company Boeing? What do you think your company really does well? Absolutely well. Also, let us see what is the core competence of Microsoft? What do you think Microsoft actually does really well? Let's identify and answers, any answers. Core competence, by the way, this word is coined by my professor. If you do not know that, you should know this word core competence was coined by CK Prahlad. The professor died about seven years ago. Core competence, that phrase was coined by CK Prahlad in a book and that is the book called this, this, where did it go? The professor is CK and he is the person that coined that word core competence. Basically it means very, very specifically the core capability on which you can do something better than anybody else on the planet. And nobody can match it. That's the core for you. So what do you think that Boeing does that is the best that nobody else can do? What is it that you think that building a plane, that's what Boeing does. That's the core competence. So that action should not be outsourced to anybody at all. What do you think Microsoft does? The core competence of Microsoft? It is writing software. That's the core competence. I don't know why chat has disappeared. I have to go and look for, I see the chat pops up, but then hold on, let me adjust it. I want to see the chat. Then I'm going to go to that window where I can see these chats. And so I see them and then I miss them, which is not what I want. So hold on. I'll fix the chat thing. Where is the chat? So I'm going to stop sharing, come back into sharing in just a sec. Chat. Build software. Yes, Vandana. Thank you. Boeing says aerospace products, Microsoft windows platform software, build software. Yes, exactly, build plane, build software. That's the core competence. Exactly right. You're absolutely right. Which means you should, Microsoft should not be outsourcing software writing to other places and they don't. And Boeing should not be outsourcing plane making to other places and they don't. However, let's see what is the core competence of Amazon. What do you think they do? Really do well. Amazon, the company, not Amazon web services. I'm talking about Amazon, the company. How do they really do well? So the chat response is again missing. I don't know why. Yeah. It's retail, right? Retail. They do retail. They know how to get the box in your home and they give you access to a choice of variety of products and variety of things all across the planet. And they just deliver it to your home the fastest possible way. They know how to run, you know, retail business as their primary core competence over the years. What has happened with Amazon is that they know that they need to have a website that needs to function all the time and they spent a lot of energy in building their amazon.com. And through that, through the years of maintaining sites like amazon.com, they grew into a knowledge powerhouse that knew how to run websites. And so they started this idea of outsourcing their competence of creating websites to other places like target.com, I think 15 years ago, service 15, 17 years ago, Target was actually hosted by Amazon. Now they have their own site, but a target.com was a part of amazon.com and they still used to ship from Target, but they used Amazon services. Now through that experience of learning to run sites and services, they finally decided that we can run sites and services for anybody. And that's when AWS started. This is about 10 years ago, 10, 12 years ago, AWS as an offshoot of what retail capabilities, the core capabilities Amazon had, they created this ability because they know how to run infrastructure. AWS knows how to run infrastructure because they clearly have demonstrated that capability. So they don't outsource it. Microsoft used to struggle with this idea of running infrastructure, but they have also now figured out how to run the Azure cloud. So they have gotten to that, that Azure cloud used to suck big time. It sucks less these days. It is still catching up. It's not there yet on par with other clouds there are, but they're improving constantly. And so that's a good thing that Amazon and Microsoft is also picking up and giving competition to these guys and to Google cloud and like that. And so if you now look at what is Google's core competence, what do you think they do the best? They do search. That's the one thing they do, but they are not in the search business, by the way. Do you know what business is in Google? Where does Google make money from? Google is actually an advertising business. Google is an ad company. They sell advertisements. That's where they make most of the money. Yes, search is a product they give away for free to get you, to hook you on to their search engine so that you can see the ads. But their primary motivation is to sell advertisements. And through that experience of running a search engine, they have also gained experience of running infrastructure. So they also have a Google cloud. Google cloud platform is also available. Now let us go see a simpler example, like a very simple example here, core competence. You are a brain surgeon. And it is a Saturday morning. And it is nice and sunny. And your lawn is kind of growing, and you need to mow the lawn. You have a neighbor. Neighbor has a teenager son, a teenager, and he's like a physically fit person. And he's your friend. So you know him. And this teenager is free, and he's doing nothing on a Saturday morning. The question I have for you is, who should mow the lawn? By the way, you are a brain surgeon and you have money is a teenager who doesn't have a job. So he's free on a Saturday morning. And the question is, you have a lawn growing. So who should mow the lawn? What do you think is the right answer? It's a trick question. You are also physically fit, by the way. You are fit. The teenager is fit. So you have the capability to mow the lawn yourself. Both are physically fit people. They can mow the lawn, move the lawn mower, and all that taken care of. But who is the right person should do it? And what is the answer? And give me the reason behind the answer. That's more important. Anybody? You can debate. This is a debatable question. I mean, there's no doubt about it. There's no black and white here. It's a trick question, though. Let me ask a different question. I'll change this question a little bit. The question will be like this now. I'll change something. I'll say it is not Saturday morning. It is still nice and sunny, but it is Monday morning. It is Monday morning, 11 o'clock. It is still nice and sunny. The lawn is growing. Who should mow the lawn? Anybody? I think that should be a clear answer. Well, definitely a teenager. Yes, yes, yes. Because it's Monday and your idea is about brain surgery. So you should go do brain surgery, man. Do your job. Do your primary core competence. And so you don't mow the lawn when it is work hours. On the contrary, if it is a Saturday morning, you are free at home and you are fit and you have money. Now the question is, should you ask the teenager to mow the lawn or not? That's the real question. What do you think is the right answer? It's very subjective. I think it's still the teenager. Still the teenager, possibly. But if you look at it the other way around, is thinking from a purely economics standpoint, pure economics. I had a professor who was a Nobel laureate, economics Nobel laureate, and I was his TA in Michigan. And so he told me one story one day. He said that if you have nothing else to do at that moment, it is nice and sunny and you are fit and you have money and you have the teenager friend. But still in that situation, when you have no other emergency calls for a brain surgery, you should still mow the lawn yourself, still mow yourself. Because from an economic standpoint, you're not making any extra money at that moment. Even if you pay like this guy pays him $30 to mow the lawn, you don't, but instead do it yourself and thereby you're economically better off. Now that was a purely esoteric economic point of view. It's mathematical point of view. That's not how actual real life operates. Most of the time it's very different. But from a pure economic standpoint, you lost $30 and you gave it to the teenager because you could have done it yourself and you had nothing else to do and you are physically fit. It is nice and sunny. The lawn is growing and it is Saturday morning and you don't have any other brain surgery operations on on on call. So there is no emergency right now. You should do it yourself. That's why it's economically appropriate for you to do it yourself because you actually save the $30. If you had anything else going on, you know, you should like you have a visitor coming in, your friend comes along, well, the equation changes because now you have to attend to the friend. So then you assign it to the teenager and pay them $30 and then you are better off economically better off. That's the idea behind core competence. You can apply this idea to any extent to like to add the level of people, individuals, small business, large business, large company, and even nations, big, big, big, gigantic, you know, countries, you know, one country outsources to the other country, like, you know, US outsources to India left and right all the time. Why do they do that? By the way, let me tell you, Microsoft, I used to outsource, I never outsourced anything that we need to remain in control. So we always write our own software and we do grant work, outsource it to India. The grant as in repeatable, you know, manual, boring work, basically boring work outsource real work. You do it yourself. That's the concept. And so now we go back to our Netflix discussion. That's what Netflix was really doing is that they figured out that their core competence was not in building equipment, cooling, electricity, network, and maintaining operating system patches. So let us not do it. Let us give it to somebody who knows how to do it. And that is one of the reasons why they chose to let Amazon manage the infrastructure and not build your own data center. That's why there is no data center for Netflix. So that is the this is the backend story, the back end, as in the server side story. That is also back end E and D. Let's go see the other other end of the story, right? The other end of the story, which is a very different story. If you now look at, let's say here, oh, there was a response here, the teachers can spend time, I guess I can spend the time in what I do best. And so that is that is absolutely right, Vandana, is that you can spend time in whatever you do the best. And you can do the best if you're a brain surgeon and you have a Saturday. In that time, you're not doing brain surgery. You are doing nothing. You're idling. And that's why economically speaking, you should do it yourself. Just economic point of view, nothing else. Any other reason falls apart. Purely economics, yes, the the opportunity cost is where it comes in. You know, when we get nothing else to do. And so another extension of the same idea here. Imagine we have Bill Gates. He is in his backyard walking and he's a gigantic beach on Lake Washington. He's walking and he sees a dollar. How he fictitious story he sees a dollar and so he's walking and he sees that dollar bill. Should he bend down and pick it up like he's a multi billionaire? I don't know how many billions, but that guy Bill walks and sees a dollar bill in a Saturday afternoon. He's nothing doing nothing but just walking in his own backyard. And he somehow magically finds a dollar bill. Should he bother to bend down and pick it up? That's the question. That's economic point of view. The answer is yes, he should. But will he? I don't know. But economically speaking, he should bend down and pick up the dollar bill because if he doesn't, then he is one dollar less rich economically speaking, although he's still in his backyard and the dollar bill probably belongs to him. But I'm just figuratively saying this idea is that if Bill is walking and he sees a dollar bill, he should bend down and pick it up. That's the economically rational approach. Anything else happens in that situation that will divert his attention away, it is fine. He should go do the other thing. But if he's doing nothing else and he sees a bill, he should bend down and pick up the bill and put it in his pocket because it is his money. That's the concept of thinking about pure economic standpoint. And it doesn't always apply to real life, honestly speaking, that that's just how economics people talk. Having said, let's now talk about Netflix. So Netflix, as you know, runs in, let's see where it runs. So let's find out Netflix devices. So here are the devices that supports Netflix and to see what they are, by the way, these days it's a long list, huge, actually, let's go see what devices they support. So long list of devices that currently works with Netflix, beginning with our favorite ones, smartphones, Android. And so why did I click? I shouldn't. So Android, smartphones, Android, Apple, Windows Phone, they used to be a thing called Windows Phone. If you remember, that doesn't exist anymore, but it still works. If you have a Windows Phone, it might work. We have PCs and tablets. So whatever PCs and tablets you have, Mac or PC or any iPad or God knows what. It did not use to, did not work on Android just a handful of years ago because Android actually had that copy protection issue. This issue it had, they had to remove that issue from the Android OS and only then Hollywood agreed to let them deliver an app for Android platform. It was not as late as, I think probably about six years ago, they started doing Android app. They could not do it. They had the app. They could not actually release it because Hollywood would say, no, don't do it. It will help people pirate. And that's why today, even today, you don't have a Linux laptop in this list because Linux contains the software that will let you copy. Yeah, you can do that. You should not do that, but you can. That's why it is prevented from playing on a Linux machine. You could actually totally still pirate. There is a problem with piracy, which is called the last, it's called analog hold. This problem is something that you cannot defeat when this is something that it is going to stay. It's not actually possible to defeat this analog hold and patch it because it is practically impossible. But let's understand what this thing is. Analog hold is basically a very simple idea. And so think of it like this. If you watch a video yourself, then you have seen it. And so there is nothing in the world of technology software that can prevent a remote user from putting a web camera on the screen that they're watching and recording the whole thing. That is a fundamental, inevitable vulnerability in copy protection. You cannot overcome it, can do nothing about it. That is something that is a fact of life. You have to understand that if somebody sees the picture or a video, they can always use a camera and record it. And there is nothing in the world that you can do, nothing in the world of technology that you can do about it. Of course, if you're in a movie theater, you can put cops in there and stop people from using a camera and all that. That's okay. But that's not always possible in a situation where you are having people all over the world watching wherever they live and so you cannot even go there. And so that's the analog hole. This is something that you need to understand that it is not possible to break this. It is fundamental and inevitable. Having said that, this is a corner case. So we understand this. Having said, we still want to have other methods available at our disposal to prevent copying. That's why you don't see a Linux solution in the PCs and laptops scenario. You still have these guys, Android and Apple, but no Linux here. We have Blu-ray players from multiple companies, your set-top boxes and consoles and Xbox and PlayStation and Nintendo, smart TVs from a variety of companies and streaming media players. It's a large collection of lists. This list has grown. But when Netflix was starting, they had nothing like this, absolutely nothing, because you have to have a device like that in everybody's home. So these are people, and here's your company, and you want to show them something. So for them to see something, you need to have a device, otherwise, how will they see? And so the devices that used to exist when Netflix was toying around with this idea was televisions, HDMI players, I should call them DVD players or DVD player devices and other types of players like Xbox, Nintendo, we had Sony, PlayStation 2, those devices used to exist. And that pretty much was the choice those days. This Netflix company had to make that decision as to whether they create a new device, let's call it a Netflix device, and put it in people's homes so that they can then watch it on the Netflix device. That was a choice, one of the options, this. The other option was to not create a device, which is what you don't see is that they took that option to not have a device, no not have a device was the other option. The question I will have for you is, why did they take this option? Why not create a new device? That's the question. What are the things that you will need to think when you want to design a new product that you don't want to have a device at all, like this, or maybe you do. So how will you make that decision? You still need a device, a device is necessary. You can figure out a solution by putting your own device in the people's homes by selling them a box or giving it away for free and asking for some kind of a recurrent subscription, subscription money, so people will keep paying subscription and as long as you have the subscription you can use the device for free and that's one choice. The other choice, what is that other choice? What do you have the other choice? Other players, Xbox, Nintendo, Sony, so this is controlled by Microsoft, this is controlled by Nintendo, this is controlled by Sony, and so Netflix doesn't control them. So what needs to happen for the user to be able to see what you want to show? Yeah, we know, we know the answer. The answer is right here. But what is this? Do you see any of these things made by Netflix? I don't think so. It is not made by Netflix, none of these are made by Netflix. So how come these things have what it takes to run it? So plugging it into other general purpose devices, yes, but plugging what? What do you want to plug? You want to plug into these devices, but what do you want to plug in? What needs to go in here, say Nintendo? What is that thing that you need to put inside Nintendo, or maybe Xbox, or maybe here? What do you want to inject? What do you call it? You know the name, you use it every day, almost. I don't watch Netflix, but you probably use Netflix. And so what is that thing that you need to have inside the boundaries of your home in a device that you have? What is that thing that Netflix needs to provide here in the device? What is the thing called? Silverlight? Sorry, say again? Silverlight? Silverlight? I heard Silverlight. Is that right? Yes. Okay. So Silverlight used to be a product by Microsoft that died. So Silverlight was this thing. They don't use it anymore apparently. Maybe they still have it. So they're still there apparently. But this is like dying. This is pretty much similar in concept to Flash from Adobe, which is also dead almost. Adobe Flash. So Adobe Flash is this thing. It is almost dying also. So most of the modern browsers don't carry it. You have to install it. But I recommend not installing it. And similarly, I recommend not installing this stupid thing also called Silverlight. They're horrible products and they're basically vulnerabilities in there. So you want to avoid that. And somebody just said, and so I think Shams said Netflix app, bingo. That's the thing you want to have in each of these places. The question is this app that you call the Netflix app. That app needs to become a part of Nintendo, Sony, Xbox, and other places and televisions. But who is going to write the app? Why will Sony write the app? For you. For you, Netflix. Why would Sony or Microsoft or Nintendo write a Netflix client-side app? Why? They would not. There is no money for them. So why would they do it? Now imagine the situation is Netflix doesn't exist like the way you know. They don't. They're new entry in the market. Nobody knows their name. Now you want to talk to big companies like Microsoft, Nintendo, Sony, and other players and say, hey, make an app for me. Why would they do that? They would not. So how do you break the game? How do you actually do it? How do you make things happen? So you talk to these guys. So FUNAI, Magnavox, Philips, Sharp, Toshiba, Sony, Samsung Club, all these guys and go talk to them and do what? Or you go to set up boxes, go talk to Atlantic and maybe game consoles and go talk to Nintendo, Sony, Vee, and why do I click that button? So the point being you have to somehow convince them. The easiest way to convince somebody like these guys that, hey, would you please create a Netflix app, the easiest way to get Microsoft to say yes is to just do it for them. So you create the app. Netflix created a Netflix app. So let's go see it here, App Store in the Apple Store and search if there's a Netflix app. Netflix, I don't think it exists. There is no app. The Netflix app doesn't exist here, but let's go see iTunes. Do they have an app? I bet they do. So let's go see the iTunes app store. Not in the music. Where is the app store? This is the problem I have is I have no idea where the app store is, but there is an app store that you know, App Store Netflix. There should be an app for that and that's the app store. And so here, the app is available, but it's only on the iPad, iPhone, so Apple TV and like that. So that is the app. Now who created it? Let's go see it. See, it is created by Netflix and same thing you will see in every company. Netflix creates this app and requests this company, Apple, in this example, to include it in the package so that people can access the app if they want to. That's one model. The other model is to preload the app in the device, preload, as in like this. And so you will see that Netflix supported devices sometimes come preloaded with Netflix app. Like here are the examples of TVs mostly carried and Netflix ads these days. Almost all these TVs will have a Netflix app built in and they will even go to the extent of advertising the app on the front page. So you don't have enough search for it. It's there because people ask for it these days because the game has changed. Because Netflix now in a commanding position, initially it was not. So they had to create an app and give it to the people. And they started with a small list. These days the list is really long list of devices available. They started with a handful. And let's see what does it take to build an app for Netflix. Let's go understand that. That piece, the piece of puzzle is, let's go to the white sheet of paper again here. So the puzzle that we want to solve or the Netflix wants to solve is this, that we have a lot of choices to now worry about if you're creating an app, let's say we limit ourselves to three devices, just artificial limit. We'll create our app for the Microsoft Xbox. We created for Nintendo, what was that thing called? I don't know all the names. Yeah, maybe we and Nintendo and the other one was Sony Entertainment, PlayStation 2. So we just limit ourselves to three devices, we create an app for this, this and this. Just to narrow down our matrix of variables, because there are too many of them. And now let us see the other end. So this is the destination, by the way. This is where the destination of our stream will go. And here will be an app, another app, another app. And there'll be more in the future, but let's begin with three. Now let's go see the source. The source is a long tail, OMG, long tail, it's like millions of movies. And you want to have a matrix of millions of movies going to three different places. That's a big task. That's what we really are to solve. Now this is just the top level view. It's going to detail about what does it really take to create an end-to-end pipe. You have to worry about the backend, which is we decided to use the Amazon cloud. We still have to worry about the front and the destination where the stream will land. And we have to create a complete infrastructure that will handle from the backend all the way to the users. And we have exorbitant, really exorbitant demand from people. And the demands are like this. Anytime, any place, any movie, any device, give me now, I will play it right now. That's the demand people have. That's the demand you want to meet. So now the problem that we're really looking at, the variables in that problem become really, really complex and complicated. And you will see what I mean by that as I describe it. Let's see some examples. So three devices here, here, and here. Now let us understand the source where the movies come from and the destination where the movies actually go and finally play. Let's begin from the source perspective. So who is the source in a classic Netflix scenario? Let's go see some examples. I'll go sign in and see if we can log in here. And I see Neelesh is watching, or we just go to kids section. So maybe kids. I don't want to play. Come on. No, no, no playing. So here is the list. Let's go with the Umbra Academy. How do I stop it? I'm just go away from this website. It doesn't make sense. So the sources of movies are actually from Hollywood. And when you go to watch a movie like Alita, for example, and it is in 3D in IMAX. And that's what Hollywood has created, by the way. And you will eventually see the Alita movie on your iPhone. But right now, we are just talking about the Xbox and the PS2 and Nintendo, just limited that to these three devices. So you want to see the Alita movie on Nintendo Wii. The movie is designed for IMAX 3D with multi-channel audio. And all of these characteristics of the movie are going to be missing here. It is not a 3D. It is not IMAX resolution. It is not multi-channel audio. So you have to do something magical between this source and the destination. Something needs to happen from here and there. What is that thing called? Some kind of a transformation. That needs to happen. By the way, this transformation needs to happen for each of these three devices. And there will be more devices in the future. So that transformation is something I will now describe in greater level of detail. Let's go see, first of all, how big these screens are for these guys. Let's go look at the screen sizes to begin with. So we'll go look at Wikipedia and say resolutions, Wikipedia, desktop, yeah, there it is. So here is the picture that will pop up that I will go open. And you will see what this actually has for us. So we'll go and examine this picture. If you watch it carefully and read it, read into the picture itself, you will find that your classic old style television is called VGA, oh no, hold on, VGA is here, not here. This is the old television. So this point is basically the size of the TV is this big. That's the size of the old style VGA television. If you go to modern, that's what you're looking at as an HDTV. But this is old HDTV. These days we have bigger, then we have 4K. And this is the 4K resolution, which is like four times 1080p, 4K. So one, two, three, four, four times of 1080p is 4K, that one. That's the resolution of 4K. Now the monitor I have on the other side is a 5K. It's even bigger than this layout. So it doesn't even capture. These are big screen resolutions these days. However, if you carefully read these numbers under the hood, let's go erase that. So we'll go read that number here. Let's go read that and study that number as to what it's trying to communicate to us here. The number was, I think, what was the number? 40962160. So the resolution of the biggest screen on that sheet of paper was 4K and it was 40962160. What are these numbers mean? It means that there are 2160 lines like this and 4096 lines like this. That's the idea. That's the resolution of that 4K television, 4K screen, I should say, not television, just 4K screen. So we know that this is called 2160p. This p is for progressive, how many lines you have here on the horizontal perspective. And this is the underlying concept of a resolution of this size. A standard old, really 20-year-old television is 480p. And even older than that was a different, smaller resolutions, but resolutions have grown and this is the resolution that most people have these days in their homes, most. And some are still at 1080p, which is one-fourth of that, just the old style HDTV. Having seen this resolution, now let us compare this with IMAX resolution. So now let's go see what is IMAX resolution. And you will see what it shows us. So here is a core article and you can read about it, but I don't think they give you a ready answer. So I'll give you the ready answer. The ready answer is like this. If you look at a IMAX screen, you will find that the resolution of an IMAX screen when you go to an IMAX theater is 18,000p as opposed to 2160p. It's really, really small compared to your 4K television. 4K is very small compared to IMAX. That's the resolution of a movie called Alita that you will see is available from Hollywood. Now, how do you compress that to make it fit a 4K TV and to fit an iPhone or an Android device? That's the compression of making it smaller and losing out on a bunch of characteristics of that video along the way. You will see what I'm talking about here is that we have to somehow manage to transform the full scale raw sources from Hollywood, which may be as big as IMAX print in three dimension multi-channel audio to strip it down into a smaller digestible size, something like a 4K or even smaller depending on the actual older machines did not have 4K support. They had 180p or sometimes just 480p. You have to shrink it down and that shrinkage happens through a software. That software is called FFmpeg. This software is open source. Let's go see that software here. What this software does, let's go see it. This is open source available on GitHub. You can see it here. What does it do? Let's go read. Here, complete cross-platform solution to, in our discussion, we want to actually convert and also stream. It also lets you stream, by the way, audio and video. You can do both. You can convert audio and video. Right now, that's what we want to do. We want to pass an input parameter and get an output in a different format. Give an MP4, get an AVI. It's as simple as that. You just run this command and you get an output, converted output. Now, you have to do this kind of processing in a greater level of detail. Yes, you can stream also along the way. Streaming is basically creating chunks of the big file and giving it one or few pieces at a time. I will see a live streaming example right now because I have created one sample for you to see it. What I'll do is actually run it right now. I'll demonstrate this FFmpeg thing to you so you can really understand and appreciate what goes on under the hood in a real-life scenario. I'll actually look at a piece of code that I'm going to run now. We'll understand this code also just a bit. I will, first of all, show you what is going on. I will first of all describe that idea first. What I'm going to do is I'm going to run this command here, FFmpeg, and it's a long command. What this thing is doing when I run it, it'll take a file here, which is one of the recordings from a previous session, and stream it. Stream it to what? This destination. This is the destination defined here. I'll clearly call it out in just a second. That streaming is what will happen from here, from my command line using FFmpeg software. This software streams it to that destination, and that destination is what is running here, which receives the stream and makes it play in a browser window. We'll open a browser, and we'll see the stream here. You will now see that this server is running. This is the server which will actually show the stream in a browser window. This is the streamer which will stream to the server, and the server will show it to us in a browser. That's what you will now see in a live example. I will now start these services right now in this workstation. Here it goes. The first one is already running on the other terminal here, and you can see it at the bottom. It is a Docker container I just built from scratch from open source that is currently running. In that example, as you see, Docker run and maps a port, maps another port. This is the web port, and this is the streaming port. It uses an image that I just constructed. I just built that image just a few hours ago, maybe about an hour ago. That image construction and that image is running. It is receiving a stream, and it is showing that stream in a web presentation. This thing will actually run a stream. I'm going to take that file and stream it out to the destination, which is here. That streaming process I will start, and then I will open a web browser on that port, which will show us what that stream is doing. This is exactly what FFmpeg can do for you if you want to stream. I will now stream that video. On the left side, run it so it starts to stream. You can see the streaming is happening on the terminal. On the right side, this server is receiving that stream. Now I should open a browser. Here is a browser window, and let's go to that section. Here I will refresh it, by the way. It's just fresh stream started. Here is one of the prior participants, and you see that I can scroll ahead a little bit, but I cannot really go forward too much because it actually is a stream. You can see the details, there's a video session happening, that stream is coming straight from the command line here. Streaming bitrate, and it is not a download, there is no download button on this page. You can see me talk, and that is me streaming from that file stored in my garage to the RTMP destination, which is the backend server, and that server is streaming on that location. That's what I see here. This file is getting streamed. That's what FFmpeg is doing for me, and this is a video player, this whole page. This is a video player here, and that video player is using open source video.js. You can read more about these applications, but that's the player portion. This is the render streamer portion, and the backend is the server that you see here. This is the server, the streamer, and the browser, and the browser plays that video of this guy. That's what's going on. Let me erase my ink, and I will stop that because you see I cannot actually do anything. I see what I see, but you can barely move forward a few minutes, one minute, 52 seconds, but that's it. You cannot go forward, cannot go back in time. It's a narrow window of about two minutes is what you get to jump around back and forth because I am doing a live stream, and it is not letting you skip forward because it is supposed to be a live stream, meaning that the future is undefined. That's the concept of a live stream versus future is defined in case of a Netflix movie. You know that there is a portion that is going to come because it's already prerecorded and just rebroadcasting for you, whereas this is structured like a live transmission, so you cannot even go forward. There are two different ways of streaming. You can treat it like a live stream, which means you have a file here. I am currently treating it like a live presentation, so you cannot even go forward with it. You can try up to two minutes or so, but that's it, and it will then get stuck and make you go back to the beginning to where it is currently streaming at. This is the concept behind FFmpeg as a live example, as you see in its raw format. This is not how you will see in Netflix, by the way, because you know already what Netflix shows you. Under the hood, this is what is going on. Let's go see a little bit detail, and you can also get to the point of the repository that I'm using for this demonstration. It's actually built using FFmpeg, and here is the source code for that. Here is the Docker file, and I just finished building that, and so you can see the Docker file is on GitHub, and I'll pass a link for you if you like. I'll just paste it in Slack chat. You will see it coming after the session. Let's go continue forward with our discussion, which is that white sheet of paper, and what we are really talking about is this transformation, and this transformation actually is a nightmare. Let's see what makes it a nightmare. Let's go see that. You have to understand the variables that we are handling right now. At this end, we just have three devices, Xbox, Nintendo, and Sony, and so each one of them has a different resolution, different one, but probably let's take it for example, this is a 1080p Xbox, and this is a 480p Nintendo, and a 180p Sony. Just assume that, but that's just a part of the story. We still have millions of movies on this side to transcode using FFmpeg, and the video resolution is just one portion of the discussion. We still have other ideas to think about. Let's go see what those ideas are. First of all, this is like a multi-track audio on the source side, because you have multiple speakers in a real theater, whereas in a regular Xbox, you can probably have 5.1 or 7.1 audio system at the max. Sometimes you just have only two speakers, left and right. That's the scenario of conversion of audio, but audio conversion is not just that. By the way, video transcoding is not just reducing the resolution from IMAX or whatever the size is of the source down to these numbers. That's not just the complete picture. There are other things to worry about along the way in your FFmpeg transcode. Those things that you may be aware of already, but I will just nudge you in the right direction to remind you of something that you already know, and I bet you know this. Let's go see. You probably have heard of this thing called MP4. Anytime you don't recognize what I'm talking about, please stop me. But I'm saying that on the video side, you already know what this thing is. On the audio side, I bet money you know what an MP3 is. So now I'll add more formats like these on both directions, audio and video. And let's see some other formats. Anytime, if you don't recognize these things, just tell me that you don't know. That's okay. I want you to know, but some of these things you probably know. Another one is... So do you know what these things are? What I just wrote down on this sheet of paper? Do you know what these things are called? What are these things? Are those file extensions? Codecs. They're coders and encoders. So they're coders and decoders. In other words, encoder and decoder. So together they're called coder-decoder combination, also known as codecs. That's how you will construct a video audio file encoded in a format that these guys want. And the iPhone, another player. So by the way, this example, M4V is the Apple way of writing a video file. This is the Microsoft way of writing a video file. This is the Google way of writing video files. This is an open standard, multiple companies came together to create a consortium for this. And that is the standard. This is a standard known as MPEG-LA, which is a bunch of companies included together as a consortium that license this software. This is not free, but this is a new version of Apple's codec also, H.265. And so like these, these are coders and decoders and encoders, N and decode, that do the encoding decoding on the target platform. So if you have an audio file, this is the Apple, by the way, this is your Windows, Microsoft way, my Windows, I should call it Microsoft technology. This is open source and there are some open source codecs also here. So the Theora, for example, Theora and then there is MKV or open source, Matroska, Matroska, open source. So a bunch of these formats are open on the video side as well as, as well as here, open source formats, open source. And so like these are encoder decoder software together known as codec. And that is a requirement. You can not assume that a WMA file will work on a Apple phone. It will definitely not work. Let me tell you, it will not work. Try to take a WMA file, play it on an Apple device, it will not play. That's how Apple is designed. Try to take a FLAC player or a FLAC file or a WAV file, WAV file will play everywhere, but this plays everywhere because it is just the raw file. It's a big file, but it's raw. It plays every machine, but it's very big. That's the problem. Too big a file. And so the OGG file is open, but then not every machine encodes or decodes that codec. Same here. Certain devices will support only certain codecs and not others, which adds to another complexity. So not just adjusting our resolution down from a big screen to an adjustable formatted size, but also we have to worry about codecs. Let's see other things. A couple of other things here. If you go to Costco and look at TVs sitting there, you will find a mention of something like 240 Hertz, 120 Hertz. Do you know what these things are? 60 Hertz. Cheaper TVs, expensive TVs. What does that mean? Frequency. Frequency of what? The refresh rate. Refresh rate. Yes. The bingo. The way behind refresh rate is that the higher the frequency of refresh, the smoother the video will appear to be when you're playing fast motion games or high animation scenario. That's the concept of frequency of refresh here. However, if you just look at a human eye, just a normal human person, human eye, and you say, you know, I will show you a picture, this P, and I'll show you another picture, and another picture like that, it's slightly changing the picture itself. And I'll show you like 24 pictures per second or more. You will suddenly see that this sequence of pictures that I see on the screen, if the rate of refresh goes faster than this, then I see a movie. But I was showing you just pictures after pictures after pictures like that. So that becomes a movie simply by repeating pictures. If the rate goes beyond this number, then the human eye will perceive that not like a picture, but like a movie. That's the concept that you already know. So these numbers actually relate to that. How frequently can you actually refresh the screen? Now in an iMac Sierra, the refresh rate is very high. Not every device will support that refresh rate for all these devices. They will have certain limitations, you know, these devices, they will refresh only only so much, only so many frames per second. Most of the time, most people cannot notice any difference between 24 and higher, but younger people do. Older people don't. Don't see much. You can probably notice, but not all the time. So same goes with audio, with speech. You have the idea of a bit rate that you can see in this example, by the way, that is running actually. You can see the bit rate happening is at that rate. So 378 kilobits per second is the bit rate that video is currently streaming right now to this machine here. And that is a bit rate, which is the rate at which the bits are flowing from the streamer to the server. So this is the streamer going on here, and that's the bit rate here. And so that's the complete bit rate of audio we have combined. That's what this server is receiving and is showing you on that port. And I will now erase this ink. But that's the point about understanding the concept of a bit rate. So we have added more variables to our complexity. We began with discussing millions of movies on one end, but now we have added resolution. We have added the idea of codecs, added the idea of a bit rate. And then we also have a growing number of devices. So we have, say, three and maybe more, and more devices will be added over time. So now we have to really account for this transcoding action, transcode. Transcode using FFmpeg. That's this library under the hood that people use most of the time. It's the dominant solution in open source. There are some commercial solutions also available, but nobody bothers about using commercial because who wants to pay license fees? And so FFmpeg is the dominant solution. These variables make the equation really complex. So you have to accomplish the transcoding action. Is one of the fundamental things that Netflix does, by the way, like we are doing a live demo here, is what, by the way, this is very expensive on the CPU. Let's go see the CPU cost by looking at some CPU metrics here. I'm going to open my monitor and see the CPU consumption. So you will see that my CPU is currently occupied by Zoom, Terminal, Docker, ResilioSync, Wacom. I think this is like a bad example because I'm running too many things right now. But what I want to do is to focus on the transcoding action, which is not visible here because other things are taken over. Hold on. Hold on. Let me just expand it. I think I want to show you the transcoding action FFmpeg should also be consuming a lot of CPU, which is what is running right now. So erasing that to illustrate the point I'm going to illustrate is that it is expensive. Oops. Oops. It's expensive. Clear my ink. There we go. And then let's see if we can identify the FFmpeg thing here. There it is. I found it. There. So that, yeah, it moves. So let me just freeze it. Let me freeze it. Sort by command. Sort by CPU consumption. I think Zoom is the most expensive right now from a CPU cost perspective, but FFmpeg is definitely one of those that is not cheap from a CPU consumption perspective. So it is an expensive thing to run. So the key is to run it on a large number of cases, like millions of movies, bunch of resolutions, codecs, bitrates, transcode them all to a variety of device types, targets. So that's the result you want to accomplish. And you want to do this action ahead of time, even before the movie becomes visible. Because when a user wants to watch a movie and you don't transcode at the time they want to watch it, you just do it already ahead of time. You want to be able to be ready when the user plays the play button. You just show it to them. That's the scenario you want to get to. So you have to do a lot of preparation to do that. So this is the work that we will now see in a live example. Actually, a picture example. In here somewhere, where is that? I think I lost it. I'll open it again. The way to search it is go to AWS architecture center. And that's where I will now open that sheet that I was talking about to begin with in our reference architectures. The sheet I will open is the media sharing sheet. And now here is the sheet. So now we'll see what we just discussed as to how that work of transcoding needs to be implemented. So what you're looking at is the illustration from Amazon, what they are calling this as the reference implementation, reference architecture for media sharing. So now let us look at this picture, lots of details here to see and read and all that. You should read that later. Don't worry about reading the concept. Let's focus on the problem that we just described and let us see how we can actually solve it. Or implement a solution using this concept illustrated in this sheet of paper. So let's imagine now that you are a Netflix employee. Just imagine. So here is you. And what do you see? The first thing you would do is being a Netflix employee, you will receive movies from Hollywood. You need to receive them. Hollywood, Bollywood, Tollywood, these guys will give Bollywood. They will give you the sources, raw sources. These files will become available to you. And so these are the files. And you have them piled up and you need to somehow upload it to the cloud. You are a person, but you can also be a robot, a robot assigned by the Netflix company that takes a look at these raw files and uploads them. So you don't have to be a physical person, but a robot that looks at the raw files and uploads it to the cloud. That can be a robot that does the job because it's kind of boring manual work. And no sane person will actually upload manually. But just saying that that's a Netflix robot here that tries to upload raw files. That's what you receive from Hollywood. Get the original source file. Here is my movie, Alita. Go take it. Now we know Alita is not available on DVD yet. And so Hollywood will decide when that movie needs to become available to a user on Netflix, like the Netflix app. They don't want to show you Netflix, Alita on Netflix right now. They will eventually show it to you. So let's see a slightly older movie like Bohemian Rhapsody. That movie I think these days is available on Amazon Prime or Netflix or also on some other places. They are like $10 and you can buy it and you can rent it. You still cannot download it, but you can play it any number of times. So those scenarios are available, Bohemian Rhapsody movie. This was a slightly older movie compared to this one. So this is a newer. So they will dictate the Hollywood studios are very, very clear in terms of timelines as to when a movie becomes publicly visible on a streaming media platform. They dictate these terms like this. What they will say is when I release a movie, I will first go to the IMAX theater. Before that, I'll actually do a premiere. Then I go to IMAX here and then at some point I might decide that I will release a DVD. And then at some point I will decide that, okay, let it go streaming. And so that dates are decided by the movie creator, the creator of the movie, which is typically Hollywood. They decide when that movie becomes available on this platform, this platform and that platform and the premiere. So the premiere happened for Alita. IMAX happened, I saw it, DVD is not available yet, but it will come. So let's see what month it is right now, March. So they might decide that in the month of June, you will have a DVD and in the month of July 4th, let's make it available on Netflix streaming. So that's the date they will give you and they will make that movie, Alita movie in the full resolution raw format, make it available to the Netflix company right now. Now they give it to you. But promise that you will show it only on this day, 4th of July, not before. And of course Netflix will agree and they'll take the movie. But what do we do with the movie? So you have a movie, what do you do with it? So you take the raw file, Alita and this one and you start processing it. This is your robot, internal company robot. And what it's going to do is upload. The first thing it runs into is a load balancing endpoint, which is typically in this example, they're trying to advertise the elastic load balancer solution from Amazon cloud services, which is perfectly good solution, nothing wrong with it. But I want you to let you know that this is not a requirement. You don't have to use the Amazon product. You can use any load balancer, like any, don't have to use that. Just let's call it any load balancer. I think that's a better way to think about it. This is a good, perfectly fine load balancer, nothing wrong with it, just saying that make it any load balancer. And this load balancer will balance the load across multiple upload web servers here. And what you look at this yellow thing here, this yellow is nothing but a subnet. This subnet will allow you to have your upload servers. In this example, they're showing you EC2 machines. But in reality, these needs to be Docker containers, which will run your upload action. And so you need to have containers running this application that will grow automatically like that and shrink automatically whenever need to. So it grows and shrinks. So the question I have for you is, when do you think this set of upload servers should grow? And when do you think that this server, that you have one more server, it grew into three servers or three containers, when do you think it need to shrink? What's the policy that you should think about of growing and shrinking the upload action on the upload servers? These are actually Docker containers. In practice, you should not use machines directly, but use Docker containers under the hood, just like we have seen in the previous examples. So this robot uploading a bunch of movies, you've got Alita, you've got Bohemian Rhapsody, and there are a bunch more. We don't even know what movies are coming in. And yes, we want to make it available. We know this movie needs to go to July 4th. This movie is going to be like March 5th, we're making up some dates here. So that's the dates we have. So this is probably already in the pipe, it's too late for March 5th, March 5th was yesterday. So the question I have for you is, what's the grow and shrink policy for these servers to grow and to shrink? What's the right policy that you could put? When should you have one more web server for upload action? I think you have to figure out a threshold, right? Maybe that's maybe that's 80% capacity. Yeah, the way to think about this is exactly how you think is in terms of the way to think about not in the capacity of these boxes. I think you grow it when Netflix take on, let's say another contract, more customer, more input coming in, right? More movies coming in, you should grow. So do it faster, get the upload finished faster, because you don't want your movies waiting for no reason that you want to let them in. So that's the concept. We have lots of movies coming in, you better grow. When you have no movie coming in at all, then you shrink. And probably have just one server running, one, just to have the machines and the entire pipeline functional. But shrink it down to just one upload server. And then you have nothing coming in, but suddenly you have lots of movies coming in. So you say, okay, let me grow. And so then you grow. That's the idea. So you suddenly grow, because there's an incoming flow of new movies. That's when you want to grow the number of servers that you have so that it automatically handles your incoming traffic. And then this robot is done doing its thing because the robot is the customer here uploading stuff. He's the customer. The robot is the customer for this service. And so that's what you should pay attention to is to make the customer happy. And so you grow these servers to make the customer, this robot happy by finishing up the queue that they carry, this queue of work. So you want to finish them off quickly and let the robot idle. So there's nothing for them to do. So they can get a new movie and then finish it off and just upload. That's the upload action. The very next action you want to do with the upload servers themselves is to just take that upload and dump it in a storage location. This storage is simply S3 bucket. So S3 is an object storage that you already know. But the concept here is that you take the raw movie as is and dump it here, raw. But that doesn't solve the ultimate problem. We still have to do something about encoding, decoding, processing, adjusting the screen resolution, adjusting the codec, handling the refresh rate, adjusting the size, the target, the target device, and all that. That processing needs to happen for a million movies, millions. I don't even know how many, I never counted. You can ask a Google question, how many movies does Netflix have? And they might give you an answer. So I'm just saying millions. It may not be millions, but just saying. That needs to go flow through this pipeline of upload and sitting in a bucket of storage where you will store the raw files. But that doesn't finish the problem. Like you still have the items that were sitting with Hollywood, Bollywood, or other words are now transferred here. You still have to process. So now comes the next idea is as soon as you have a new movie, Alita, coming in, uploaded into the bucket, that you also do one more thing at the same time. This guy, upload server, needs to not only upload here, but also create a to-do list. The to-do list is very simple. It says process Alita. And there's a checkbox here. And so Alita needs to be processed. When the processing finishes, the checkbox needs to go market complete. And at that time, you will have a resulting file containing all the form factors, all the resolutions, all codecs, all devices available in the bucket. Right next to the raw file for Alita. You will also have this device, Sony, Nintendo, PlayStation, this resolution, that resolution, that codec, all these resulting files are also going to be available for Alita movie in the repository. And that is the final action. But before that action finishes, the action, the to-do list will contain process Alita. And you will not have these to begin with. You will just have the raw file. That's it. The to-do list item. This item to-do list will sit in a queue. And that's the job queue that we need to use. And Amazon is suggesting that we use the SQS service, Amazon as a service. They call it SQS. So fairly good service, but you don't have to use that service because there are open source solutions available. As usual, like for every single thing, you will have an open source solution available, by the way. For example, load balancing, there are solutions like HAProxy, there is NGINX, there are more. You can go search, but these are the dominant ones. So you just use them here. Like I've seen a demo of the other, the other day I show you a live demo of NGINX as a reverse proxy and all that. So that, that's an implementation that doesn't cost you money. It is open source. That's the recommended solution. It is the best performing solution also. Of course you can use this. And of course you can use the Amazon SQS, but don't have to. You can. Nothing wrong, by the way, nothing technically wrong with SQS is perfectly good. I'm suggesting that you explore other solutions also like RabbitMQ, open source. And there are many Q solutions available like that. You can also create your own Q using Redis as a database. It also acts as a Q. So Redis is a very small, efficient in-memory database, also acts as a Q and also acts as a data store and it is open source, redis.io, RabbitMQ, Redis. And there are many such solutions. You can implement a Q. Basically it's a to-do list for our purposes. That's what you really want right now is a to-do list that I have the Alita movie here in the raw format and I need to process it because this robot is gone, he's done doing his task and now we have to worry about the process. So we'll now talk about that. So we now have in the Q, it can be an SQSQ or it can be some other Q that you like, your own implementation, which carries a to-do list, which says process Alita. And the movie is here. And this web server has shrunk, there is no new movie coming in. So it's only one box or one container, one upload server. That's it. That's the scenario. Now we have to understand who will actually do this work. Processing Alita involves running FFmpeg on some boxes, just like I'm running it here. Let me break that one. So this one is running for no reason, so I'm breaking it. This one is running for no reason, so breaking that one also. So broke both of them and quit and quit and quit and quit, so a bunch of things are running. So break them, quit them. So now we have a Q item and we need to take care of the Q. We have a movie and a Q item. We need to process that. And so who's going to do the work? This is grant work, like a lot of work, running, transcoding, and it's like we had to create it for three different devices. And so that transcoding action has to be done by some processing servers. And that is where we need a processing pipeline. So this pipeline is also another auto scaling group, which contains a subnet that grows and shrinks containers running FFmpeg, just like I showed you. And it will be the processing pipeline. What do you think this processing pipeline will actually do? It will run the containers that you have, which contains the FFmpeg code and actually produce these outputs for the three target devices that we had, Sony, Microsoft, and Nintendo, just three to begin with. You can have more later on, but right now three. And that's the action, Alita processing. So this processing servers will actually do the task of finishing the processing. So what they will do, who's the customer here? Who is the customer for this service, for the pipeline processing? Who is the user of this? Who is the customer of this service that does the processing? The customer, immediate customer is this queue. You want to keep the queue as small, as close to zero as possible. You want to basically be done, done, done, done. You want to be done with the work that needs to happen. That's why you need to service your queue to bring it down to zero. So that is your customer from a very micro perspective. This processing pipeline needs to serve the queue. The queue needs to become zero. If it is not zero, then processing pipeline should do the work. What is the work? Well, you have the raw file, you have to create three different files for three different devices. That's the work. You have a queue item that is not done yet, not done yet. So better do it here, you do it. That's the work that needs to happen in the processing pipeline. So now the next question. When do you think this processing pipeline should scale auto scaling? When should it grow and when should it shrink? You have a queue. That's the only thing you have, these upload servers are doing nothing, there's no new files coming in. There is a queue, which has a bunch of items to do list. And that's a queue is basically think of it as a stack. A stack meaning you have a pile, another item, another item, I should say not pile, but item item. Item on top of items. So that's a stack. That piles up that big stack. So the huge amount of work sitting in the queue. So when should this processing pipeline scale out, grow and when should it shrink? That's the question. What do you think? So let me tell you a way to think about these things. The way to think about these things is to look for the immediate customer, who will become happy when we do the work. In this context, this queue will become short or small or close to zero, meaning happy queue as opposed to piled up items in the queue, which is not happy. I mean, it's not a human, but I'm just figuratively saying that a happy queue is an empty queue with nothing to do. So you're done and everybody's happy. So that's a happy queue. So when you have a happy queue like that, what should be the number of units running here? When you have a zero queue, how many machines should be here in the pipeline? Zero or one? Zero. Bingo. Bingo. Zero. Absolutely zero. You should kill every box and make it zero because you're wasting money by keeping one box. Even one box is going to be a waste of money. And so when you know the pipeline is, queue is zero, you should kill all the boxes. Gone. At the moment you have a new item popping in, you should grow. You have more items popping in and your CPU is not able to handle the work that you're doing. So you grow one more and you grow and you keep growing. So that's the way to think about this idea. It's very, very simple, who's the immediate beneficiary, who's the customer and are we making them happy? That's the way to think about scaling. Simple idea. Really simple. It just needs to be thought through in the context of what we are really discussing and it is micro discussions right now. We are really talking about one queue and one service. And so here is the queue. Anil, are you saying zero boxes because it's so fast to spin up one of those? Exactly. Exactly. It takes like a microsecond for a container to start. So why bother? So it's cost effective to not have a box, right? If you had a box running at all times and you're wasting your money. Yeah, exactly. In fact, you should leave one box here just in case for this incoming upload. But actually you can get rid of that also, practically speaking, if you're into containers, you should make it zero. There's no reason to run it. You can shrink it down really, really small. But here you can actually get rid of all of them, get completely gone because you don't need them. You can spin a server up very effortlessly, very efficiently, very quickly. And if you are containerized, it is even faster. You can just see how quickly containers start. You've seen it, like microseconds. So you just start, boom, there we go. Starts processing. And immediately the queue becomes from a to-do list, it goes to the doing list. And then it becomes the done list. So from to-do, it jumps to doing. And then when it is done, it goes to done. And when it is done, it is happy. And then when you can kill the machines again. So that's one perspective. Let's see other perspectives. In the same point of view here, there's one more perspective, which is very, very important, which requires me to draw another picture. So here's the picture. Now imagine, I'm going to give you an example of something very lame, just to get you to think in the direction. Let's see what example will be best. Yeah, that one is good. So here, I want to go driver license. I go to DMV, Department of Licensing, RMV, Registry of Motor Vehicles, whatever. In your state, you have different names for the same thing. You're basically getting a driver license. And here is you. And you go in. The first thing you notice is there is a person. That person is an officer of the DMV or Motor Vehicle Registry or whatever you have. And that says, you know what, you should go to the desk, this desk, this desk, and this desk. There may be more desks. Each of these desks will have an officer. And that officer will service. And so you come in, and this is, by the way, your load balancer. This is your load balancer. It balances the load and says, you, sir, should go to that officer. So then you go there. Now, this officer is going to handle your case. You ask for a driver license. They'll check your credentials and eligibility and say, OK, I'm going to grant you a license. So here we go, granted. And then they give you what? Do they give you the actual license at the same time? The plastic license that looks like this with a picture and a name? They don't. They don't give you the immediate formal plastic in your hand right away. Do you know why they don't give it to you right away? Why? Why can't they give it to you right away? They could. If they could, they would. They cannot. Because they don't have the facility to print it, like plastic printing and security verification, all that thing needs to happen on the picture. And so they cannot immediately give it to you. It takes time. Creating a plastic driver license takes a little time. And most of the people that come in here, like after you, before you, are basically frustrated that they are going to deal with the government and they're going to be waiting and waiting. And they're already frustrated. You go and sit here on the wait list and then eventually you will get your turn. So you go to that officer, already kind of frustrated. And then this officer will make you wait. If they want to print a formal plastic license in the back office, they will have to make you even wait longer, which is going to add to your frustration. And so you don't want to get your end user customers, which are your citizens in your country, you don't want to frustrate them because that's a bad thing. They're your customers. And so you want to actually offload the back office action somewhere else, in another location. Not this officer. Absolutely not. Because what you want to do, this officer should immediately give you a paper license and say, Hey, here it is. Go use it. It's a valid license until the actual one arrives. So you go, you are basically done. And you let you go, you are free to go wherever you want. You're basically done for practical purposes. You still don't have a license, but legally you do. You have a paper license, fine. Now on the backside here, there is a queue. The queue is, is just like the queue that we discussed is the queue is, it has an item. So print plastic license for you, that's another entry, another entry, that's a queue accumulating in the back office. And that needs time. Printing a license can take maybe just say an hour, you know, just, just saying takes time. So this queue is there and there is a back office somewhere in Nebraska. I'm just saying some, some, some location, some, some random location, far away from you. And that's where the queue goes. So you will do this work. Now in that location, they'll tell you upfront that it might take eight weeks for you to receive the actual license, right? Up to eight weeks. They might tell you that. So they already told you that your current paper license is valid up to eight weeks and that your back office will prepare a plastic and mail it to you in your home address and all that and you're happy you go and the license will eventually arrive. They told you eight weeks, eight weeks. Now here there is somebody or some machine or some process that is going to handle the queue items. So you have an item in to-do list, we'll take the item from to-do list to the doing list. And when it is done doing, it will put in the done list and at that time you're done. That means you mail the license to this person and that the person is finally taken care of. Now at this moment, your people or your robots or whatever you have in your back office are processing say this one for you. And as they're processing it, something happens to the person, the person who's doing the work, the worker. The worker says, you know, I need to go to some marriage or some other friend's marriage. So they just take off. So I want to go three days away. So what happens to the halfway processing? Your license being processed and they just stop working. Does it matter to you at that moment here? Do you care whether this person goes on vacation or marriage or whatever that scenario is? I don't think you care. You don't. Does this worker's manager, do they care? I don't think they care either. We will let them go on vacation and go a marriage, your friend's marriage, go take vacation. You stop the processing for now and put this item not as done, but back to the to-do list. And that's okay because you have enough time, eight weeks, the person will come back and then do the work eventually and then you will receive the paper. So that was an example. Look at this picture again. You have a to-do list item and this machine is probably working on it. So it's doing it. And this machine is, let's say in the Amazon cloud, it's an EC2 machine. And let's say Bezos decides that, you know what? I need to exercise my muscle and I will show the world that I am very influential. So he will come and just delete the machine. Yeah, that's a very, very crazy example. I just hold on with me on this idea. He just says, you know what, I'm going to delete the box. I know you took it from me. Yes, I know. And I'm going to just shoot the box because I'm Bezos. And by the way, I'll pay you money because I shot your box. And since I have a lot of money, I'll pay you money. Here, take some, take a dollar, maybe 10. I don't know what the price is, but I'll give you some money and I'll kill your box for no good reason, just because I can. The question for you is like this. If that is the case, if Bezos is willing to give you money and want to take away your control on these boxes, and he might say that I will come and shoot your boxes, like completely delete them, I'll pay you money. If that's the proposal from Bezos and you're in the Amazon cloud, my question is, would you take that? So would you take the proposal? Would you take the money and keep it and let him shoot your boxes anytime he feels like? Will you let that happen? Will Netflix do that? That's the real question. Will Netflix take that money and let Bezos come and kill these boxes anytime Bezos feels like? Will Netflix do that? That's the real question. Now again, think like this. Think like the manager of the worker. Worker wants to go on vacation. He's like halfway processing your work. He's not done yet, but he just suddenly decides, I want to take a vacation for three days and so he's gone. Is the manager okay with that idea? Absolutely yes, because you have enough time there, right? So that's the, that's the background here. I'll go back here. Same story, work, worker, this is the work, this is the worker, Bezos, money. Would you take the money and have the worker be shot? What do you think? The answer is yes, by the way. Well, I think, I think I would do that if it takes second, like what you said, if it takes second to sign up another box. Yes, yes, exactly right. Bingo, bingo. You got it. That's exactly right. You would take the money because you know, you can start another box. And that is a new idea we never discussed before. And that idea is called a spot instance idea. You're welcome to go. You can always catch up with the video recording. Somebody wanted to go. So point that I'm discussing right now is this, this concept of a spot instance, which is exactly what you, what you heard me say Bezos, Bezos gives you money and kills your boxes anytime he feels like, but it gives you money. So that's the idea. Now it is okay for you to take that money and let Bezos kill your box because you can always start another one. And that's what you should do is take the money and let him shoot your boxes. And let's understand this concept here called spot instances by actually visiting the Amazon cloud. Let's go see that. So let's go here. Amazon cloud and let's go figure out what that actually does amazon.com. I'm going to log in here to show you the point, which I think we never discussed before in our program up until now. So we are now discussing that idea. Here we go. And we'll start a machine now, launch and select an OS and select a slightly bigger size. You know, these T2 micro machines are too cheap, too small for us to even bother saving money. So I'll go a little bit bigger, something like M5 large, it's a reasonable size. So let's go see what the M5 large size means. And so here is M5 large. And the pricing for that is the pricing here, M5 large pricing. Come on, give me the price, price M5 large there. And the pricing is in Oregon, M5 large pricing is here. And the price number is 096 per hour. So it's fairly reasonable price, but it is actually expensive price. This number is expensive. Just remember that number, by the way. We'll look at that number again, M5 large 096, it's a 9.6 cents. That's what I want you to remember that number just for now, for our 9.6 cents per hour. And I'm calling it expensive. Now let's go see the actual run. So we have the instance M5 large selected, and we go to the configuration details. And here something that you should pay attention to is this idea, which we never discussed before, is the idea of purchasing option here. You get to choose spot instances. And by that, what it means is that this is an option to buy a machine that Bezos can come and shoot anytime he feels like. The current price is this, these are the prices. The actual price that you remember from the sheet pricing sheet is this, it was 9.6 cents. If you go full price, if you go spot price, the price is 3.38, 3.38, 3.43 and 3.38 cents. So slightly different prices. This is a little bit expensive for this region, for this availability zone. But apart from that, the prices are roughly about a third, like there's about 66% discount, roughly speaking. So that's what Bezos giving you money, Bezos pays you money, that discount. And as a consequence of you getting that discounted price on a spot instance, what you lose is the ability to retain control on the box. That means Bezos can actually come with a gun and shoot your box. And you should let him do that. Because in this example that we are discussing right now, which is here, the context here is non-critical. You have the queue and your movie Alita needs to become available July 4th. And today is March. You have enough time between now and then to finish processing the movie called Alita. So you have the movie here, you can create the process and result files can be created in between that period. Enough time available to you. There is no reason to spend full dollar, like full 9.6 cents per hour. There is no need to spend that money. Instead, you should spend only this much, which is the current market price. This number changes up and down all the time. It is the current spot price. Spot price is pretty much like eBay price, where people bid for a price. So you know that is the current market price, which means if you make a bid for 3.39 and ask for a machine, you will actually get one. You don't have to pay 9.6. If you ask and bid for a 3.37, and I will do that by the way, I will go this example and I'll show you what happens here. In Amazon, we'll go look at the current market price and I will say, I will now bid. I will pay you 0.337, a tiny fraction of a cent less than this number here, and that's I am willing to pay. I know the current market price is higher, which means even if I request this machine, it will reject the request because I'm not willing to pay the price in the market. If I say 3.8, I might get a machine. If I say 3.9, I will very likely get a machine. The moment I go higher than this, I get a machine in that region. If I go higher than this number in that region, in that availability zone, I will get a machine. If you match that price, you might get a machine allocated. If you go below that number, you will not receive a machine. Here if I say that number, 0.3, whatever that number is, if I say that number and say, hey, give me a machine please, Amazon will refuse. Let's go see that, how it refuses. I put the dollar number, which is like a fraction less than that number, the market price, and I say, okay, add some storage and review and launch. I will say, okay, launch, and I select a key pair and all that good stuff. You will see that it is stuck. The request is stuck. You will see that the request was submitted and we see our request and it will probably fail. Let's go see. Unless the market price changes, the request is open and the current status is price too low. It's a one-time machine I wanted. I wanted for 0337, the market price is slightly higher. My request is stuck and waiting, open request. I can, of course, delete that request. I can say, action, cancel the request, and then the request goes away. You can also see historical prices, for example, M5 Large for the last three hours. This is what you see. The prices have been what you see on the screen, these numbers, that line for the last three hours. Let's see a little bit more historical prices. One week, or rather three months, let's go see what happened in the past three months. You see something very, very unusual, and let's go understand what this means. You're looking at a three-month price history of the M5 Large instance and the spot pricing history. The prices today, right now, are that number for March 3rd or whatever, March 6th. That's the number we have here, that price. If you go back in history, you will find that the price actually went up in this region. Only in that availability zone, the green-colored item, this green color, shows you that this jump, and this jump happened on this date, apparently, January 15th, when the price went to about 0.10. See that? The on-demand price is 0.96, so it's 10 cents, roughly, maybe 9.6 cents, part of that price. It basically matched that price. What you notice right now is the scenario where Bezos is coming and shooting your machines. I'll show you where it happens or why it happens. What happens is, in this segment, in that availability zone, most people here are spending that money, and they're basically cheapos, cheapos trying to take the free option or the cheaper option, which is perfectly fine. I'm just calling them cheapos because that's what they are, and that's what they should be, but they're filling up the Amazon cloud with cheap machines. Amazon doesn't get compensated much as a consequence of this. What happens when you have a full-paying customer comes along, they want to pay the full price, and they don't see any machines available? That's when Bezos comes in and says, the price right now is this. He just raises the price. As a consequence, your price too low scenario that was there before, a few seconds ago, prior to that, it was not low because you probably were paying the right amount of money at the market price, but then the market price itself, Bezos comes and changes to 9.6. That renders your machine below the price, so it gets shot at that time. All this price increase that you see is basically, it is a cleanup of the cheapos. All the cheap loaders, like whatever taking free or cheaper machines like that, they will be destroyed by this price hike. Their machines will be terminated, and thereby making room for Amazon to let full-paying customers that want to pay this amount with a full price, not a spot price, let them give access to machines if they get fully flooded with cheap loaders, they will be killed like that. That's a kill example. This is perfectly fine in our use case because it's okay to get killed because we can always start another machine and pay the full price if you like. That's not that big a deal, at least for a few days, because we know the price is going to come down. It does happen all the time. You can observe these historical prices, every single machine type, by the way, this is just one example. You'll see more examples if you like. The point is, when you have a need for a machine that you absolutely need to have, you better pay the full price. If you know that you can tolerate some destruction, because you know the person here, he can go on vacation, this worker, he can go on vacation, you don't care, the manager doesn't care, and even you don't care if you get a license like in seven weeks from now or six weeks from now, you don't care as long as you get the license. That's where it is important for you to actually not spend too much money, full price money, but instead go spot price. That's the concept. You should absolutely identify such opportunities to save money in your company when you know that the need is not critical, as in time critical. When it is time critical, go here. This is the way to go. When it is not time critical, go this way. Totally do that. I do that all the time. This is how I save money, by the way. This is how Netflix saves money all the time. Everybody should do that way, is the approach to handling prices of commodity, which is what these things are, that cheap boxes. And so we'll now, we just discussed a new concept right now, which was this idea of pricing. There are a couple more variations of the same idea. I'll just describe that also briefly before we switch on back to our Netflix discussion. So the idea here is like this. So my question is that, yes, you select spot instance to save money. But if you have a need, then you pay full price and you say you do that all the time to save money, right? That's the end goal. But if we have to do it manually all the time, it costs our time. I know. I know. Yeah. I'll describe that. Let me repeat your question. The question you have is that this change from one type to the other is also expensive because it costs people time, right? You don't want to spend people time. You want to get people free to do what they want. Very good idea. What I am saying is that when you have a scenario which requires criticality of result, you pay the full price. When you have a scenario which does not require criticality, it can tolerate some damage. In that scenario, you should pay spot price and you should actually study the flow of your applications as to how the things are flowing. For example, let's go see another sheet here. So I'm going to go back to that same illustration here. You see in this picture, as you will see in a subsequent discussion that I will discuss right now, here is another auto-scaling group of web servers. Here are where actual customers of Netflix will watch from the web servers. Now, that scenario is a critical thing to have. You will never use spot in that setup because it is customer critical. You want people to be watching Netflix web servers and that is a scenario where you will never use spot. But in this scenario, you know it's a queue. I mean, come on. And you have enough time from now through July 4th to finish the Alita movie processing. So it's okay for these boxes to be using spot instances. So for such type of work, you allocate a collection of machines that are spot. And for such work, which is critical, you don't use spot. You just design your application structure in a manner that segregates these things already to begin with. And later on, you don't have to worry about it, which means in any given application, you will have to use both types. For certain uses, like this one, go cheap. For certain other uses that are critical, don't become cheap. You pay the full price, 9.6 cents, pay the full price. But by the way, before you pay the full price, there is a third thing to discuss. That's what I will be discussing now. The third thing is when you know it is critical and it is immediate, that you absolutely pay the full price of 9.6 cents in that example of M5 Large. When you know that you can tolerate some damage, you pay the 3.8 cents, the cheaper price. There is a third option. So this option is like, I go by retail, I look at the list price, and I just shut up and pay the full price, and I get the machine, and I'm happy because my needs are met, and the result was immediate and critical. That's all fine. Nothing wrong with that approach. When I know I can tolerate some damage for those application scenarios, I will go this price and that is the right way to go. However, when you have a critical need, but you know that you have it critical and you know that this is going to be there all the time. It's perpetual need, like for example, my simple example is my need. My need is that I need to have this site running all the time. It needs to run. So I don't go cheap here, not on this site. I do something different. I don't pay the full price either. I don't go spot either. I do something different. And that's what I will describe now. It is critical, but it is somewhere in between the two. So like here, from 9.6 cents, I get a 60, 65% discount, and I go to 3.8 cents. That's a 60% discount, 60, 65%, something like that, discount. Now a middle ground is somewhere in between where you know that you have a critical need. You cannot let Jeff Bezos come with a gun and shoot the machines, and you still want to save some money. So for that, you have to give them a commitment. This is simply the eBay price. This is called a contract price, and this is called list price. So whatever the price is listed, you just shut up and pay, full price. If you have a commitment to make, and it is critical, you enter into a contract. Say, hey, Bezos, I know I need the machine, and I don't want you to come with a gun. So don't shoot my boxes. But you know what? That is too expensive. So give me some discount. I promise that I will keep this machine running for one year, like one full year. Let me just go to the actual screen to show you these things. I'm going to close out on this. So that request got canceled. So let's go see the other price types. So here, what I would like to talk about is the idea called reserved instances. And here, you can actually purchase the reserved instances in a variety of types, a variety of scenarios. Let's go see that. So I want to get a machine type of, say, M5 large. Where is the M5 large? Here. And I want to get it for one year. And I will pay nothing upfront. On a recurring basis, I'll pay by the hour, on an hourly basis. But give me some choices. So what do I get? Well, I get something. Let's see what it is. So what I find, what I get from Bezos, is that they're going to give me a machine, but I have to commit for a 12-month period. And if I pay no upfront, then I'm going to effectively paying them 6.1 cents compared to 9.6 compared to 3.8. This is the spot price. This is the commitment price or contract price. And this is the list price. So what I'm saying is, when you know that you have a need for a perpetual basis for a long period of time, you should actually enter into a contract with Bezos or with other clouds. They all have similar methods, all of them. You just have to find out what is the amount you will pay upfront, what's the term commitment you want to make, and then add the item to cart. In the amount of machines you need, check it out. And you're basically entering into a contract here. That's a commitment you make. And by making that commitment, you get a discount at 30%, as opposed to a discount of 60 to 65%. But that is a different game. It's the eBay style spot prices. This is your contract commitment price. This is a list price, which is a stupid thing to do. It's okay to do for a one-off, for a transient immediate need. It's fine. If you know that you need to have a machine running all the time, you better get the 30% off and get this rate by making a commitment. And that is the rational approach to selecting a machine type or selecting a contract type. So this is the Amazon discussion. There are three ways of pricing. The three ways are list price, eBay price, contract price. And so question here, do list, contract, and spot have different service levels like guaranteed uptime? The list has, contract has the same, spot comes with a guarantee of downtime. They will come and shoot your cows. Absolutely. They guarantee that they will kill your machine. At some point, they don't know when, but Bezos will come. If not today, he'll come tomorrow. We don't know when, but he'll come. That's a guarantee. So that is the service guarantee for a spot instance. Otherwise, when he is not shooting your cows or machines, you're fine. Everything else is similar. But when he comes with a gun, he'll just raise the price, shoot your machines, and then you're dead. Then you are in an auto-scaling group, your new machines will start and all that is fine. It will still function. You will still have some damage, but then you can tolerate it because it's okay. That queue item did not proceed. So you finish, put it back in the queue and we'll process it again. When the next time, next server comes up, you take that new action and do it. Not a big deal. Who cares? Who cares if the machine goes down? Because I don't. I just go cheaper out and take the cheaper out and live with it and live happily for that scenario. That's the eBay style pricing. The service levels are structurally similar, except this one comes with Bezos coming along with a gun occasionally and shoots your machines for no good reason. Here, he's committing that he will absolutely make sure that it will not be shot because it's a commitment. You are also committing that you will keep paying them for one year term. So that is what you just saw in this example. Let's go see one more example here. So I'll just change the term to 36 months and let us search. What you notice, what you just noticed is that the prices went down even further. Now it is for no upfront, you pay 4.2 cents on a three-year contract. So it's even cheaper, full price 9.6. The three-year contracted price is 4.2, three years. This was 6.1 for one year and this was 3.8 for spot. The spot market prices can go up and down. These are contracted prices. So they freeze for three years. This is frozen for one year. And this is, yes, you're right. The question is, I imagine similar structure exists on other providers like Google and Azure. And yes, it does. They just call it different names. And so they have similar things, except this spot thing is kind of unique to Amazon. So that is, Google has an even simpler option. They don't believe in these kind of gimmicks. It is kind of gimmicky from a perspective of Google. And so what Google says is that, you know what, don't do this stupid thing. I'll simplify it for you. And here is what Google does. Let's go see what Google does. So go to Google Cloud, cloud.google.com. And let's see what happens when we start a machine. So it is VM instances and you try to get a machine. And so here is create a machine. And the pricing here. So the pricing is like this. There's to be a picture here that is not available anymore, but hold on. I think it is called sustained use discount. That should have a picture. Yeah, there it is. So the idea that Google has is very, very simple from a pricing perspective. We have simplified a whole lot. What they say is, don't worry about this spot pricing versus contract pricing or list pricing. Don't worry about that. We just have one price for you. You start with that price and you use the machine and you use it for a full month, we'll automatically give you a discount. Just automatically give it to you. So if you use a machine for like one day, two days, 20% of the month, then we'll charge the full price. If you cross over beyond this 25, 20, some number of percent, then we start to accumulate some discount for you. And if you use up the machine for the whole full month, we'll give you roughly 30% discount automatically given to you. Just give it. So you just use the machines every month, 30% discount given to you even without a contract. This is like built in pricing structure like that. So that's the pricing structure, which is a whole lot simpler concept to understand. Effective discount rate, 30% if you use it for the full month, use it part of the month, that might discount even less, even less discount, very, very less, like few days, no discount. Simple pricing, no gimmicks. That's the Google way of thinking. I think I like this approach because I don't want to worry about it. So automatically I get the discount by using the machines. If I keep using the machines, I get 30% off given to everybody. I think something wrong happened. I hope you heard, I'm going to just repeat that last sentence. What Google says is that you don't have to worry about this contract negotiations. Just I give it to you. That's the pricing. I think it's a very simple concept. This idea that Google calls it, what do they call it? They call it sustained use discount. I think that's the name. So let's go adjust my screen again here. And the idea is sustained use discount. There is also another type of discount called committed use discount, which is conceptually similar idea. But it actually, they count up to 57%. So it's even more discount and depends on the machine type. So this is like long-term commitment. If you enter into a commitment of three years or one year, they might give you a 57% discount for some machine types. And for high memory machines, large amount of RAM, the discount can be up to 70%. So it will basically go look at the pricing structure and then select appropriate machines for commitment for three years or one year, depending on what your term of usage is. And that's conceptually similar ideas, but implemented in different fashion from different cloud providers. Having seen and understood this idea, what I would like to now do is to see if we can play a auto-scaling example. So in our cloud, we are looking at this scenario, where is our scenario? Here, yeah, this picture. What I want to be able to see is if I can run an auto-scaling group and have it scale. So auto-scaling group, here, here, variety of different types. I want to see if we can put this in live action by actually creating an auto-scaling group and putting some workload on the auto-scaling group to see how it actually scales by itself. That's the exercise I want to be able to do. I think we can finish this in the next 15 minutes or so. That's what I suspect. So let's go see if we can do this. So I'm going to, hold on, that requires, no, I think we need to finish this discussion off before we can run that exercise. So let me finish this idea first. This rest of the items on this single sheet of paper, which is a lot of things to discuss and understand. So that's, I think we need to finish that before we can run that exercise. So finishing off this discussion, let's go see the other scenario, the flip scenario. So this robot brings in movies, gets uploaded here, and then this processing pipeline will take the queue and process it down to zero and all the movies in three different formats for three different target devices are available in the bucket in the storage location. When this processing finishes to zero, you have to create another entry in a database telling your system that Alita is now ready for Xbox, Nintendo, and PlayStation. And that entry needs to go here in a data store. When that entry is in the data store, what will happen as a consequence is that you need to put some commercial aspects around this entry along with the data about the fact that you have a result available for Xbox, for Nintendo, for PlayStation available stored in your storage. And the data store knows about this, that you have this file here that will handle the Xbox, this file here handles the PlayStation, this file handles the Nintendo. So you know that files exist in the repository here. And the database entry is there in your data store. In addition to that data entry, you have to have a bunch of other details along with just the file references for you to actually make something useful for your end user. So the end user now is this person, this person like you and me who are outside Netflix and are looking at Netflix.com with a DNS query, and they run into a load balancer. And what they see is a web server that is serving them. So these servers are containers running in the Amazon cloud. In this example, in another auto-scaling group, what you see here is what you actually see when you visit Netflix.com. So what do you see? You see this, which we saw briefly. You know that. I'm going to just show you quickly. I think it makes noise, so I don't like it, but you know what I'm talking about, the list of movies in Netflix. This is the first screen you get. And so you have the person, this is, by the way, a new feature, the persona. This is me. This is my wife and my son. And that's the scenario. So you select your persona who's watching, and then you go inside, and then you will see movies, the collection. When you actually see the movies, you see a lot more detail about the movie. And that detail is stored in the data store, like here. That data store, it needs to store a bunch of data about the movie. Like I just talked about, this data store needs to store the movie about not just the file references of Xbox, Nintendo, and PlayStation, the references to the files, but also a bunch of detail. And I'll now show you what that detail would look like. You probably know this, but I'll show you in a different fashion. So you will probably appreciate it better. So here we go. Let's go to IMDB, and there we'll go look for Alita. And IMDB is a place where you can find data about something, like here is your IMDB scenario. And what you're looking at is a trailer, and the director, the writer, and other details. And you can see them scoring, reviews, popularity, and apparently it is not popular. I thought it was going to be a good movie. But what you see is this picture that you looked at, the movie, the availability date, the action adventure, the genre, the name, the title, the rating, all these things about the movie itself. And here is another detail about that movie. So all this detail needs to be preserved in your data store, like here. That means you have to have a place. Is there a question? That data store, this data store need to store information about every single movie that this user will see, every million, all the million movies that you have. Millions of movies, they will have an entry in the data store. And in addition to all these details about the files, and the data, about the movie, the metadata about the movie, you will have one more characteristic. And that characteristic is the date of release. We know this movie, Alita, will be released by July 4th. So we need to have that date in the metadata, in the storage, about that movie, so that we will not accidentally expose the movie to the web servers. So it will be hidden from you until that date comes along, at which day it will just pop up on the browser windows of these users. The users will see on July 4th that that movie is now available for you to play. So when you play that movie, what happens next? That's the scenario that I think I already showed you a demo about on the terminal and the browser window is where the video plays in a browser, where I'm streaming from and the server actually captures the stream and streams it to a web browser, like you saw in a live demo that I just showed you. If you want to play with it on your own, just ask me for the code, I'll pass it to you. You can play with it. It's going to become an exercise in our bootcamp subsequently, it's in a construction phase right now. So I'm building a new exercise to show these concepts of streaming as we go along. Right now it is in its raw format, I just finished processing it. So it works now. You can see it, explore it, expand it, modify it if you like. Just ask me for a link. I'll paste a link for you in GitHub. You can watch it. It's open source. Having said the date that I mentioned, July 4th, is something that we need to really worry about from a business standpoint because you don't want to be accidentally letting go of the movie to the user because if you do that, Hollywood gets really pissed off. You don't want to be pissing off your biggest customers. That's where the biggest suppliers, that's where the movies come from and you don't want to be messing them up. So you want to actually make sure that your contract obligations of not showing the movie before the deadline that you committed to. And so that has to be kept track of in your data store. Now comes the idea of actual streaming to the end user. So this user, let's say he has an iPhone. And by the way, that user, we had Xbox, Nintendo and PlayStation and we had to add an iPhone. So that iPhone processing needs to be finished through the pipeline and an entry shows up here and an iPhone file shows up here and all that for the movie called Alita. The processing is assuming that it is finished. This iPhone user, he opens up a DNS query, goes to Netflix.com and lands on this web server. That's where they see, and by the way, today is July 4th, just assume. And so they see the movie Alita popping up in the browser window, Alita. And what they do is play the play button. When they play the play button, something happens. And that's what I will now focus your attention on, what exactly happens in the context of what these web servers are going to do. Let me tell you the short summary of what this idea is, is that these web servers will not do much apart from just passing on control to another service. That's it. That's what the web servers do. And I'll show you a live example of what I just mentioned. So you open the iPhone, go to a browser, you see the Alita movie, you want to press the play button. As soon as you press the play button, control gets handed off to another service. Let's see what that plays out in real life. So here, the site, expand. And by the way, this video that you're looking at here, this one, the one I play, that video is coming from not Cloud Genius. Just want you to know that. It is coming from another service. Let's see where it comes from. I don't think I disclosed that here, but you can actually go dig in the code and find out. But it comes from Vimeo. You can actually see it, see if it is visible. Or you can go to the network tab and examine that it comes from Vimeo. No, it doesn't show you. Yeah, there it is. There, there's the Vimeo player. So you can go to that link and that's the service which is actually rendering this video. So it is not coming from the Cloud Genius servers right there, not from here, but from here. So what happens is, by the way, this is the web server and this is the streaming server from this company that I have hired, outsourced. So when you play the play button, just like Netflix, I can show this in a live demo because this is my property. I don't want to be playing a Netflix video for copyright violations. And so this, when I play, the control gets handed over from this web server to the service. And the service starts streaming here inside this frame. And it just shows. That's exactly what happens in Netflix also. You can see these things in great level of detail. If you actually, so let's see if I can erase my ink and grab that link and go there directly. See what happens. Well, you see the video directly playing in the window, in the browser, in the full screen because that's an openly available, openly accessible video. So anybody can go to that site and just access the video. Every other video is kind of hidden. So it doesn't expose that URL directly for people to go and consume because I have protected that URL route. It still plays inside the player. That's exactly what Netflix also does. They let you watch the movie in that window, but they cannot let you go watch it here. They also have a service like that. And you will now see that service implementation in the picture that I was going to point out to you now. And that's what I will now show you is here. That service is also implemented in the Amazon cloud by Netflix. And that service is here. And this is the content delivery network, like Akamai, like CloudFront, like every other cloud has a content delivery network, CDN. And what these web servers will do is basically hand off control to the CDN here. You drive the delivery of video. The video delivery happens through cloud content delivery network, which is going to pull the videos from the bucket and pass it off to the user. So the user actually views the video in a frame rendered by the web server. Inside that frame, the video will actually play through a content delivery network, CDN, and will expose the movie that you have authorized, this web server authorized you to play. So you grant the permission and the movie flows like this into the same window where the web server has created a frame for you, just like you see in here. This is the actual video and this is the frame. The frame comes from the web server. The video comes from here. That's the idea. And with that, I will actually stop recording because we've reached the hour. We'll stop it. We'll resume our discussion the next time we will get together again on a live session as scheduled. The next session is Friday, where I will see you live. I am still open for questions if you have any. And I am going to stop recording.