CDNs help you speedup your website
but also kinda securing your servers
this is what we’ll go through today
Let’s do it
But don’t forget to subscribe and like
How do they work
CDNs spread your static assets
such as HTML, CSS, img, and JS to servers around the globe
This helps with latency
Latency being how much time it takes to communicate with a server
Latency for a website is often more important than raw performance
Servers are fast
but bandwidth is limited by this idiot here
called Einstein
and him telling us how fast the speed of light is
With your content spread out across the world
That means a client avoids the roundtrips to your server
For example,
Let’s connect to your server in California but from Dubai.
Then it might have 500ms latency.
If we setup a CDN using BunnyCDN or Cloudflare
then it might only have 30ms since BunnyCDN
have a server in Dubai
Requirements and limitations
Your requirements for using a CDN is that your data is static
It doesn’t matter if you’re using an MPA or SPA
it will be possible to use a CDN.
Now, if you’re having a MPA
You have to ensure that the cdn is setup to only cache cookie-less
as a page with cookies can mean you’re logged in
meaning the cached version contains the user logged in info
thus exposing that user
Masking your website
CDNs can also help you with securing your server
Kinda,
CDNs can be setup infront of your server
and thus hide your servers’ real IP address
This means DDOS attacks will have to go through your CDN provider
and CDN providers have heavy server-infrastructure to deter DDOS attacks
But, remember there are no silver bullets
both in life and in software
Setting up a CDN infront of your server also means
that all data is flowing through the CDNs server
So far, there haven’t been any mayor scandals around this
but the centralization of our internet is a worrying trend
It’s easier for a three letter agency to “convince”
Cloudflare to give up 100k websites
than it is to hack those websites
Cool other features
CDNs also offer other cool features such as
Streaming your videos
Compress, cut or minify files
And even doing AI stuff on images
The opportunities are limitless for static assets
Ending
Are you using a CDN yet?
Why?
or Why not
Ещё видео!