How to Scale Your App to Global Levels - System Design — Transcript
Full transcript
- 0:00this video we are going to be talking
- 0:02about how we can scale an app to go
- 0:04across the entire world so this is going
- 0:07to build on some of the principles we
- 0:09talked about with horizontal scaling
- 0:11when you take a server and to grow you
- 0:16will add multiple servers working
- 0:19together as a single unit this is the
- 0:22idea of horizontal scaling but what we
- 0:24didn't talk about is where are these
- 0:27servers located or where is the entire
- 0:31collection located are they very close
- 0:33together or are they spread out across
- 0:35the world so let's first talk about when
- 0:37you horizontally scale how close will
- 0:40those servers be located to one another
- 0:42now we're going to talk about a few
- 0:43different options here but first you
- 0:45might want to check out the previous
- 0:46lesson which talked about horizontal and
- 0:48vertical scaling that'll give you the
- 0:49foundational information as well as two
- 0:51other resources the first being the
- 0:53backend engineering mind map and this is
- 0:56a comprehensive overview of everything
- 0:58you might need to be familiar with if
- 1:00you want to become a backend software
- 1:01engineer another resource is I have a
- 1:03mentorship program if you want guidance
- 1:06in learning these things and succeeding
- 1:07at technical interviews check that out
- 1:09I'll have links for those below so if we
- 1:11grow to multiple servers these could be
- 1:14within the same data center or they
- 1:17could be in different data centers in
- 1:18the same region so same data center or
- 1:21same region diff Data Center and what
- 1:25exactly is a region well that's kind of
- 1:27vague but let's just say it's you know a
- 1:29a certain amount of distance you might
- 1:31have a data center in a different region
- 1:34but we'll say it's still within the same
- 1:37country so for example within the US you
- 1:39might split the us up into multiple
- 1:41regions and you might have data centers
- 1:43in different regions but they're all
- 1:45within the United States and then lastly
- 1:47we could have servers in completely
- 1:49different countries and those could be
- 1:52across different continents even now
- 1:55this is the stage you want to get to if
- 1:57you really want to bring your app Global
- 2:01and that is built off of the assumption
- 2:03that the Earth is truly a globe but
- 2:05we're not going to get into that in this
- 2:07video but just think about it this way
- 2:09right like if the Earth was a globe how
- 2:13would flat shoes work wouldn't you have
- 2:14to have shoes that were like slightly
- 2:16curved to match the curvature of the
- 2:19Earth come on guys all you globiste
- 2:24theorists why am I even getting into
- 2:26this so if you're a True Believer in the
- 2:28globe Earth theory then I'm going to
- 2:30need an answer for that question
- 2:32otherwise we're going to get back to it
- 2:34now I'm going to change this to
- 2:35continents because that's where the
- 2:36biggest difference comes up as there are
- 2:38regions that are in different countries
- 2:41but still within the same continent so
- 2:42you might group those regions as North
- 2:44America regions for example and we're
- 2:47going to get into some of that in a few
- 2:48moments so we're basically looking at it
- 2:51from closest together to most spread out
- 2:54for this one they are in different
- 2:56regions but they're still within the
- 2:58same region set most most likely the
- 3:00same continent and then lastly
- 3:02completely different continents so let's
- 3:04go through each one of these the first
- 3:06one being the same data
- 3:11center now you can think of a data
- 3:13center just as a building or potentially
- 3:15multiple buildings but all one location
- 3:18so there might be a company or a cloud
- 3:20provider that hosts a bunch of stuff
- 3:22from one data center in one location so
- 3:26if you have multiple servers let's say
- 3:28we have two servers
- 3:30and they're in the same data center it
- 3:32might be the case that these are
- 3:33physically located right next to each
- 3:35other and you can imagine this improves
- 3:37the application somewhat because if one
- 3:40of the servers breaks the other one is
- 3:42still there to take traffic so this
- 3:44helps the service become highly
- 3:47available and it helps with the
- 3:50scalability because you have two servers
- 3:53instead of just
- 3:54one this does not help with
- 3:57latency because these servers are pretty
- 3:59much right next to each other it doesn't
- 4:01matter if I make a request to this one
- 4:04or this one it's going to take roughly
- 4:06the same amount of time so it does not
- 4:08really impact the performance of the
- 4:10application for any individual request
- 4:13it does help with the overall
- 4:14performance because it allows us to have
- 4:17more users cool so that is all within
- 4:20the same data center now let's talk
- 4:21about within the same region but
- 4:23different data centers so for us to
- 4:26understand things being in the same
- 4:28region we should first understand what a
- 4:31region is and it's a little vague and it
- 4:34probably varies from cloud provider to
- 4:36cloud provider we're going to take a
- 4:38look at AWS as an example here but the
- 4:40idea is probably very similar for other
- 4:42services out there so within AWS you
- 4:45will have a collection of different
- 4:47regions based on continent so for
- 4:50example in North America there are
- 4:53currently eight regions and I think a
- 4:56ninth one is coming soon and that's
- 4:58based on the time this recording so
- 5:01these numbers might change in the future
- 5:03but there's eight different regions in
- 5:05North America right now you'll probably
- 5:07want to pick a region that's fairly
- 5:08close to the users of your application
- 5:11these are all given some name such as us
- 5:16East
- 5:191 or Us East 2 there's Us West one US
- 5:25West 2 so for example if you're going to
- 5:27be serving a lot of users in California
- 5:29you probably want to go for one of the
- 5:31West regions compared to the east
- 5:34regions now these are different
- 5:38regions but for this level of scale
- 5:40we're talking about different data
- 5:42centers within the same region so if you
- 5:45just select one of
- 5:47these obviously we're going to go with
- 5:49us East to Ohio represent let's go all
- 5:52right so within here we're going to have
- 5:54multiple data centers so there may be
- 5:57many Data Centers inside of us East too
- 6:00but we're going to split those up so
- 6:02we'll have different availability zones
- 6:05which are logically separated data
- 6:07centers So within a region there are
- 6:10multiple data centers so these logical
- 6:12groupings the availability zones as AWS
- 6:15calls them will have names like us East
- 6:222A Us East
- 6:272B Us East
- 6:312 C so in this scenario if we want to go
- 6:33within the same region but different
- 6:36data centers we would split up those
- 6:38servers into two different availability
- 6:43zones so now we have a server here and
- 6:46we have a server here the different
- 6:49availability zones within the same
- 6:51region are physically separated but set
- 6:54up in such a way that they can
- 6:56communicate between each other very
- 6:58efficiently so you can imagine we have a
- 7:00group of data centers over here a group
- 7:02of data centers over here and then a
- 7:03connection between them for data
- 7:05transfer there's a good chance they're
- 7:07both not going to be impacted directly
- 7:09from a power outage but they're still
- 7:11within a fairly close distance and
- 7:13they're set up to communicate quickly so
- 7:16you are a bit more safe from issues that
- 7:18might impact an entire data center or
- 7:20availability zone so these guys are set
- 7:22up to be able to communicate
- 7:26efficiently but they're physically
- 7:28separated so they're in the same
- 7:31region diff availability zone so this is
- 7:35going to improve the high availability
- 7:39so it's going to be more available than
- 7:41if they're in the same data center
- 7:43because we are removing a single point
- 7:45of failure physically having just a
- 7:47single location for the servers so now
- 7:49if there's a power outage there's a
- 7:51chance the service stays available it
- 7:53will still help with scalability because
- 7:55we have two servers so that hasn't
- 7:58changed either in terms of latency it's
- 8:01probably not going to make a major
- 8:02difference because the servers are so
- 8:05close together that it's not that big of
- 8:08a deal like they're both within Ohio so
- 8:11if you're making a request from
- 8:12California doesn't really matter if you
- 8:14hit this server or This Server because
- 8:16they're so close together so the biggest
- 8:18benefit in this step is that you're
- 8:19protecting yourself against issues that
- 8:21might impact a complete availability
- 8:24Zone possibly leaving your service
- 8:26completely unavailable if both of your
- 8:28servers
- 8:32possibly leaving your service completely
- 8:33unavailable if they are within the same
- 8:36data center or availability zone so the
- 8:38major benefit you get going to this step
- 8:40is protecting against issues that could
- 8:42impact an entire availability Zone if
- 8:45they were both in the same location both
- 8:48of the servers then you could
- 8:50potentially go completely unavailable if
- 8:52something happened to that location so
- 8:55that is the major benefit you get from
- 8:57having things within the same region but
- 8:59splitting it out to two different
- 9:01availability zones this is a fairly
- 9:03simple step so it's not going to add a
- 9:05lot of complexity to your architecture
- 9:07so I would probably recommend doing this
- 9:09for protecting your high availability
- 9:11all right so we go beyond just a single
- 9:14region we're now ready to go to multiple
- 9:16regions so we could have servers in
- 9:18different regions so in this scenario
- 9:20you can imagine having a server on the
- 9:22west coast of the US and on the east
- 9:24coast of the us and we somehow need to
- 9:27get these things to work together in
- 9:28this scenario you might need to do a
- 9:30little bit more setup than the previous
- 9:31scenario because we want these servers
- 9:34to work together but there's a good
- 9:36chance we're not just going to evenly
- 9:38load balance across these two regions
- 9:41let's see how good I can draw the US
- 9:59pretty flipping good if you ask me so
- 10:03let's just say you have a server here
- 10:06and a server over here and you have
- 10:07people making requests from all over and
- 10:11you know maybe even outside of the US so
- 10:13these are different clients making
- 10:16requests to servers now we probably want
- 10:19to keep in mind their location when we
- 10:22direct them to a certain server so it
- 10:25probably makes sense for this one to be
- 10:27directed to This Server same here this
- 10:30one maybe here and this one may be here
- 10:32so we don't just want to blindly split
- 10:36the traffic across the two servers
- 10:40because that gets rid of the major
- 10:42benefit of going multi- region which is
- 10:46that we can make servers closer to the
- 10:48clients making requests so instead of
- 10:51just having a load balancer that
- 10:52surrounds both of these you'll probably
- 10:54use geolocation routing so this will be
- 10:57at the DNS level directing based off of
- 11:01the location of the request so where
- 11:03does load balancing come in then most
- 11:05likely you will individually scale these
- 11:08units based off of the amount of traffic
- 11:12in that General region so let's just say
- 11:14in theory this is getting
- 11:1675% of the traffic to your API in this
- 11:20case and this one's getting 25% this
- 11:24means we could give a lot more Computing
- 11:26resources to this unit over here and
- 11:28less to this one over here when it comes
- 11:30to load balancing instead of just
- 11:32thinking of this as a single computer
- 11:34you can think of it as a single unit or
- 11:37a single service logically so this might
- 11:41actually consist of multiple computers
- 11:44so you can imagine it to look something
- 11:45like this where we actually have three
- 11:47servers in this region this one might
- 11:50consist of just two servers they can be
- 11:52different so the load balancing is most
- 11:54likely going to
- 11:56happen at this level
- 12:01so we split the load between these
- 12:03individual servers and we split the load
- 12:05across these servers and another thing
- 12:08to keep in mind is that for each one of
- 12:10these I'm just going to draw some arrows
- 12:11here because I'm running out of space
- 12:13these could be in different availability
- 12:17zones So within the same region but in
- 12:21different data centers so that goes off
- 12:23of what we talked about in the previous
- 12:25section same idea here these could be in
- 12:27different availability zones
- 12:30so I'm going to erase this and do a
- 12:31quick summary of this so take a mental
- 12:33snapshot remember how beautiful my us
- 12:36drawing is so let's make a little
- 12:38diagram showing the flow of a request we
- 12:41have the client making a request I'm
- 12:43imagining this to be a web page
- 12:45requesting data from an API this is
- 12:48going to use some kind of geolocation
- 12:52based
- 12:54DNS and this will be the way that we
- 12:58know which
- 12:59section to direct to and this is the
- 13:01step where the client is given one of
- 13:04the regions maybe that's West Coast
- 13:06maybe that's East Coast based on the
- 13:07location of the client so you would set
- 13:10this up at the DNS level so for example
- 13:12in Route 53 and there are various
- 13:14techniques to doing that maybe that's
- 13:15something we can get into in more detail
- 13:17in the future but for now we're just
- 13:18going to kind of assume this level works
- 13:21we need some way to direct to the
- 13:24appropriate region this will be
- 13:25especially important once we move to
- 13:27multiple continents because we don't
- 13:29want to be sending people from Europe
- 13:31all the way to the US or from us all the
- 13:33way to Europe because of that latency so
- 13:35this is an important step we're just
- 13:37going to kind of gloss over for right
- 13:38now assume that works so this is going
- 13:40to direct it in this case one of two
- 13:43different ways we have region
- 13:46one and then we have region two you can
- 13:48think of this step kind of as a load
- 13:50balancer for cross region but within a
- 13:53single region this is where we'll
- 13:55actually have a load balancer same thing
- 13:58over here
- 14:00most likely if we have multiple servers
- 14:03in one region so that's going to be a
- 14:05single end point that is hit when the
- 14:08client is routed to that region and this
- 14:11is going to route to let's say three
- 14:14different servers on this side and just
- 14:16to show that it doesn't have to be the
- 14:17same all of the time we could say we
- 14:19have two servers over on this side we
- 14:23can scale them independently so you can
- 14:26horizontally scale independently meaning
- 14:28adding more servers on one side than the
- 14:30other and you could vertically scale
- 14:32independently as well so you could
- 14:34increase the size of one individual
- 14:36server if you needed for some reason
- 14:37which probably don't need to do if
- 14:39you're going to be horizontally scaling
- 14:41but just so you are aware that that's
- 14:43possible so this is one way to do it but
- 14:45if you also include the split across
- 14:48multiple availability zones it's going
- 14:50to look a little bit different so it
- 14:51might look like this where we have
- 14:53availability Zone a availability Zone B
- 14:56so it may look like this where this
- 14:59availability Zone has two servers and
- 15:01this availability Zone has one server
- 15:04same idea over here so we'll have
- 15:06availability Zone
- 15:07a and availability Zone
- 15:12B and this one will have a
- 15:16server and this one will have a
- 15:18server so this is what it may look like
- 15:22so one request might be routed like this
- 15:25we go from the client with DNS it routes
- 15:28us to region one ultimately giving us
- 15:30this load
- 15:31balancer choosing to direct us to this
- 15:35availability Zone and ultimately to This
- 15:38Server the question now is what happens
- 15:40if we have some other services that this
- 15:43service needs to interact with most
- 15:45common one that I would think of here
- 15:46would be a database so let's say we have
- 15:48a database here and this API server
- 15:50needs to read data from the database so
- 15:53it's going to make a request to the
- 15:55database and every server might need to
- 15:57do that so if we're over here we might
- 16:00also need to make a request from that
- 16:02database so we basically did all this
- 16:04Fancy Pants routing but then we
- 16:06ultimately have to make a request to
- 16:08another server which this line here
- 16:11might introduce a substantial amount of
- 16:13latency if we route somebody through to
- 16:15a West Coast server and then that West
- 16:18Coast server has to make a request back
- 16:20to an East Coast database then it
- 16:22defeats the purpose of sending them to
- 16:23the West Coast server in the first place
- 16:25we could just have everything over in
- 16:26the east coast and we wouldn't have to
- 16:28worry about all this multiple region
- 16:29garbage we could just keep it simple so
- 16:31all that to say is as you spread things
- 16:33out it introduces new complexities
- 16:35because now you have to think about all
- 16:37the other services that this service
- 16:39interacts with let's say this request is
- 16:42100 milliseconds and this one is 200
- 16:45milliseconds now let's say we sent that
- 16:47same client over to the east coast and
- 16:50through this process it takes 20000
- 16:54milliseconds but then the database
- 16:56request because it's closer to the
- 16:58server to
- 16:59100
- 17:00milliseconds the total time here is the
- 17:03same so if you look at these these add
- 17:04up to
- 17:06300 and these add up to
- 17:10300 so it wouldn't really matter if we
- 17:13directed the person on the west coast to
- 17:15the West Coast server or to the east
- 17:17coast server because it's just going to
- 17:19adjust the numbers between the API layer
- 17:21and the database layer ultimately giving
- 17:23us roughly the same value now I know
- 17:25there's a lot going on here and I'm
- 17:26almost done so we'll clear this off in a
- 17:28second but I wanted to mention two
- 17:29potential fixes for this that we're
- 17:31really going to explore in much more
- 17:33detail in upcoming lessons one way to
- 17:36address this latency concern is to have
- 17:38a multi- primary database or multimaster
- 17:41multi- database where not only do you
- 17:44have the database over here but it's
- 17:47connected to another instance over here
- 17:50this could potentially be much closer to
- 17:53This Server so instead of directing the
- 17:55traffic up that way we could direct it
- 17:56up this way reducing that lat from 200
- 18:00to let's say 100 improving the overall
- 18:04performance for that request that's one
- 18:06potential fix so I'll just write these
- 18:08up here so having multiple right nodes
- 18:10in your database now the next possible
- 18:13solution or at least Improvement here
- 18:15would be a little bit simpler especially
- 18:17if you're working with like post grass
- 18:19or other relational databases you could
- 18:21just have read replicas so in the case
- 18:23of read replicas you'll still have this
- 18:24database instance here but it will be
- 18:26limited to just reading wow this is
- 18:29getting insane but that's going to at
- 18:32least improve much of the performance of
- 18:35the app it's often the case that we do
- 18:37majority reading so so in the case of
- 18:39social media most of the time you're
- 18:40reading the feed you're not writing
- 18:42posts as much as you're reading posts so
- 18:44that's one way we can improve it as well
- 18:46and it's simpler than having multiple
- 18:48right nodes but we are going to again
- 18:50get into databases in much detail in one
- 18:53of the upcoming lessons I've been saying
- 18:55that for multiple lessons now but we're
- 18:57building and building and building we're
- 18:59almost there so keep that in mind we're
- 19:01going to address this in a future video
- 19:04in much more detail a third one which
- 19:06I'm not going to draw much for would be
- 19:08cashing so specifically
- 19:12the I said specifically like I had
- 19:14something specific in mind that my brain
- 19:15was like duh so with caching there's a
- 19:19bunch of different caching levels we
- 19:20could talk about we've talked about them
- 19:22some when we were talking while scaling
- 19:23an app to millions of users but here are
- 19:25some examples we could completely cach
- 19:28pages so we don't even have to make a
- 19:30request to the API we could cache
- 19:32certain things in the database in a
- 19:34local cache which is much closer to the
- 19:38server so in the same region in that
- 19:40situation instead of reading from the
- 19:41database you would read from the cache
- 19:45and then you would only need to hit the
- 19:46database if you didn't find the
- 19:47information you were looking for all
- 19:48right I'm going to erase this before I
- 19:50throw up and we're going to do a quick
- 19:51quick summary of what we just talked
- 19:53about so we just talked about splitting
- 19:54an app across multiple regions it
- 19:57definitely increases the complexity as
- 19:59you probably can tell from our previous
- 20:00diagram but it's still a way that you
- 20:03can improve latency this will also help
- 20:05us with high
- 20:07availability now the chances of
- 20:10something going wrong that affects
- 20:12multiple regions man that's bad so we
- 20:15definitely have higher availability and
- 20:18we can definitely scale the app more so
- 20:21scalability now let's talk about a few
- 20:23concerns the complexity which includes
- 20:26setting this up as well as communication
- 20:29between services that are in different
- 20:31regions such as if you have a database
- 20:33you have to access that's in a different
- 20:34region always draw upward it drives me
- 20:37crazy and potentially this will be
- 20:39higher costs so if you're in a scenario
- 20:42where you're ever transferring data
- 20:44between regions you might be charged for
- 20:46the movement of that data you can do
- 20:48additional research on that if that's
- 20:50something you might be doing but the
- 20:52idea is that as you spread things out
- 20:55there is a cost to moving things that
- 20:57you'll need to account for for and
- 20:59here's just something to consider which
- 21:01is this still might not be Global the
- 21:03ideas we talked about are pretty much
- 21:05going to be the same when we're working
- 21:06with regions that are outside of North
- 21:09America for example but if you start
- 21:11running servers from other countries or
- 21:13other continents there are a few other
- 21:15concerns you need to be aware of and
- 21:16that's what we're going to talk about
- 21:17next so we've talked about three
- 21:19different deployment options when it
- 21:20comes to bringing your app global the
- 21:23first being just everything within the
- 21:25same data center pretty limiting the
- 21:26next splitting across Data Center but
- 21:28within the same region then splitting
- 21:30things up to different regions and now
- 21:32we're going to talk about splitting
- 21:34things up into different continents now
- 21:37the regions are often grouped by
- 21:39continent but some of the concerns I
- 21:41want to talk about are going to be at a
- 21:43country level potentially so
- 21:45specifically this has to do with user
- 21:47information privacy and different rules
- 21:50for different countries so if we want to
- 21:53take an app global we have to worry
- 21:55about local concerns
- 21:59so whatever the localization
- 22:00requirements might
- 22:04be and this is going to depend a lot on
- 22:08the type of app you're building and I'm
- 22:10definitely not going to cover this topic
- 22:12adequately you will need to do as much
- 22:15research as you can if you're going to
- 22:17be storing data in different countries
- 22:20and you're going to be building an app
- 22:22that works across multiple countries
- 22:23where you have servers running in
- 22:25different countries working with two
- 22:26regions in the US is probably going to
- 22:28be treated the same legally but if you
- 22:30have a region in Europe that's going to
- 22:33be different than in the US I'll go
- 22:35through a couple quick examples in the
- 22:37US there's something known as cui which
- 22:40is information that's not classified but
- 22:42still sensitive that's probably
- 22:44something you don't want to be storing
- 22:46in servers and other continents I don't
- 22:49know the ins and outs of the laws for
- 22:51that and that's just one example of data
- 22:53but if you were working with classified
- 22:55information for example then yeah that's
- 22:57probably even going to be more strict on
- 22:59where it can be stored I think different
- 23:01Cloud providers might even have
- 23:03specialized instances for certain types
- 23:05of data So within the US you might be
- 23:08able to get a server that has some
- 23:11additional restrictions but I think AWS
- 23:14has some gov Cloud instances or
- 23:16something that might be more compliant
- 23:19for certain rules or laws so you can
- 23:22look into that it's going to be pretty
- 23:24similar for European data so gdpr or
- 23:28health records of people in Europe that
- 23:30might be something that you have to keep
- 23:32physically located in Europe again I
- 23:34know I've said this but I'm not an
- 23:35expert on any of this stuff I just
- 23:37wanted to bring it up to make you aware
- 23:39of it I feel like if I left this out it
- 23:40wouldn't be complete but it's something
- 23:42that's really specific for the type of
- 23:44application you're building and what
- 23:46countries you're going to be servicing
- 23:48you can imagine if a large percentage of
- 23:49your user base is from say China maybe
- 23:52there are some certain laws you have to
- 23:53adhere to depending on what type of data
- 23:56you're storing so the two biggest things
- 23:58to to think about when it comes to going
- 24:00to different continents the first are
- 24:02the potential latency improvements
- 24:04especially if all of the services that
- 24:07your request is going to hit are in that
- 24:09region so if you're using some kind of
- 24:11global database like Dynamo DB Global
- 24:13tables where you can write and read from
- 24:16multiple regions that's going to
- 24:18drastically improve the performance
- 24:20because the latency is going to go down
- 24:22a lot consider making a request over the
- 24:24internet from Europe to the US that's
- 24:26going to take a lot longer than if you
- 24:28could keep everything just in Europe for
- 24:30a European user and then the other thing
- 24:31to concern yourself with are any local
- 24:33laws for where you're storing data or
- 24:36the users that are accessing your
- 24:37services now there's a concept multi-
- 24:39region failover so let's say you had two
- 24:42regions and these were pretty far apart
- 24:45because you're working on improving
- 24:46latency for users but say something goes
- 24:49wrong this region is not working you can
- 24:53direct everybody down to the other
- 24:56region so not just people who are local
- 24:58but people that are far away this really
- 25:00does go back to the geodns stuff that we
- 25:02were talking about but just wanted to
- 25:04let you know that it's not something
- 25:06where one Region's going to go down and
- 25:0850% of your users can't use your app if
- 25:11there are no concerns about localized
- 25:13laws or whatever there's a good chance
- 25:14you can just direct traffic over to
- 25:17another region and that can often be set
- 25:20up to happen automatically so you have a
- 25:21very resilient service now I wanted to
- 25:24talk briefly about CDN again this might
- 25:27be some review from the the previous
- 25:28videos but I wanted to talk about them
- 25:31within this context as they can help us
- 25:34achieve similar results to routing based
- 25:37off of geolocation so this is basically
- 25:40going to put your content on a bunch of
- 25:46edge
- 25:48servers across the
- 25:50world so this goes back to what we were
- 25:53talking about with caching this is
- 25:54another form where if somebody makes a
- 25:56request from right there they will
- 25:58probably hit that edge server whereas if
- 26:01somebody makes a request from right here
- 26:04they might hit that edge server so it's
- 26:07kind of like a little hack so that you
- 26:09can get some of those benefits of being
- 26:11Global without having to have such a
- 26:14complex architecture now typically these
- 26:16are for static files so HTML CSS
- 26:20JavaScript images videos those kinds of
- 26:23things that's where CDN shine however
- 26:25because of the focus on the static
- 26:28content it might be more limited than
- 26:30having a server in different locations
- 26:34that's cdns in general but there may be
- 26:36some variations so potentially you could
- 26:39cash responses from apis that would also
- 26:42improve the app performance then it's
- 26:44kind of like you have a distributed
- 26:46server but really it's just a snapshot
- 26:49of a very recent response so if you have
- 26:52data that you're retrieving that doesn't
- 26:54update very frequently you could
- 26:56potentially cash that response making
- 26:58things faster across the world or
- 27:01something that is a little bit different
- 27:03than this traditional CDN idea are Edge
- 27:07workers so you could imagine each one of
- 27:09these being a
- 27:12server that can do
- 27:14computation so if there's a way we can
- 27:17basically distribute our API layer
- 27:20across many Edge servers in this
- 27:23scenario we could have a true backend
- 27:25that's distributed across the world if
- 27:27you're interested in learning more about
- 27:29this idea you can research cloudflare
- 27:31workers most likely adding a CDN is
- 27:33going to be a step you would do fairly
- 27:35early on in your app deployment process
- 27:38I would probably do this almost first
- 27:39thing because it's going to immediately
- 27:41improve the performance for users across
- 27:43the world and often there are other
- 27:45benefits packaged with it such as
- 27:46security and dos protection and SEO
- 27:49benefits cool so that's a summary of the
- 27:51CDN lay perhaps that's something we'll
- 27:53do a dedicated video to All the ins and
- 27:56outs of CDN and how they work what you
- 27:57can can cash what you can't cash how
- 27:59caching Works maybe that's interesting
- 28:01if so let me know and maybe we'll do a
- 28:03video on it now when it comes to scaling
- 28:05databases that's what the next section
- 28:08of videos is really going to be about so
- 28:10we'll talk about some general database
- 28:12Concepts so the cap theorum and other
- 28:14things like that and that's going to
- 28:16build a foundation for us to understand
- 28:18the different types of databases that
- 28:20exist when you might want to choose one
- 28:22over the other and all of the ins and
- 28:25outs when it comes to scaling the app to
- 28:27support more and more users so I would
- 28:29encourage you to leave this video with
- 28:31the intention of following up with the
- 28:33next video so you can continue your
- 28:35studies there's a lot of information but
- 28:37it's fun it's cool we get to draw on a
- 28:39chalkboard in what other scenarios do
- 28:41you get to draw cute boxes and arrows
- 28:43and call it studying so let's stick with
- 28:46it stay tuned for the next lesson we
- 28:48will talk about database stuff and I'm
- 28:51sure it'll be a great time thank you so
- 28:53much for watching this video as a
- 28:54reminder I'll have links to resources
- 28:56down below which will include the
- 28:57backend engine mind map and the link to
- 29:00the mentorship program if you want to
- 29:02take it up a notch when it comes to your
- 29:04career and your ability to pick up this
- 29:06information thank you so much for
- 29:07watching and I'll see you in the next
- 29:09ones
About this transcript
This page contains the full transcript of How to Scale Your App to Global Levels - System Design by Caleb Curry, generated from the public captions YouTube serves with the video. The transcript has 5,196 words across 750 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.