Pushing Boundaries to the Edge

Rate this content
Bookmark

While the technology goes further and further, web development tries to get closer to the user. CDNs and web servers are evolving, and they now offer us the possibility to execute server-side logic without depending on a unique data center located in a specific place in the world. Let’s present the concept of The Edge. We will see how it works, and we’ll talk about Edge Functions. We’ll discuss why the main hosting providers are introducing this technology, and why different JavaScript frameworks are modeling their approaches based on Edge computing.

This talk has been presented at React Summit US 2023, check out the latest edition of this React Conference.

Watch video on a separate page

FAQ

Facundo Giuliani is a Developer Relations Manager from Argentina, managing the Developer Relations Team at Storyblok. He is also an organizer for React Buenos Aires and Dev Summit Argentina.

A Content Delivery Network, or CDN, is a group of geographically distributed servers that speed up the delivery of web content by bringing it closer to where the users are. It hosts and caches static assets like images, videos, and web files to improve performance and reduce bandwidth consumption.

The Edge provides improved performance, enhanced security, real-time insights, and easy scalability. It processes client data as close to the source as possible, reducing latency and allowing for efficient handling of dynamic content and server-side logic.

Frameworks like Next.js offer Edge functions that execute server-side rendering distributed across different regions. These functions utilize an Edge runtime built on the V8 engine, optimized for performance, and can perform tasks based on user interactions and data.

Edge computing can be used for personalized content delivery, geolocation services, A/B testing, and enhanced security measures like authentication and authorization. These capabilities allow developers to serve dynamic content efficiently and securely.

While both Edge computing and serverless functions aim to reduce server load and improve efficiency, Edge computing processes data closer to the user by distributing server-side logic across a network of servers. Serverless functions, however, can still rely on a centralized server, which may reintroduce latency and performance bottlenecks.

Middleware in Edge computing acts as an intermediate layer that executes custom logic before a request is fully processed. It can manage tasks such as user authentication, content customization based on user preferences, or A/B testing before delivering the final content.

Edge computing extends traditional CDN capabilities by enabling dynamic content processing and server-side logic execution directly at the Edge. This approach reduces latency, improves security, and allows for more complex application functionalities to be handled nearer to end-users.

Facundo Giuliani
Facundo Giuliani
21 min
15 Nov, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

CDNs were introduced to improve website performance by bringing web content closer to users. The concept of the edge addresses the limitations of CDNs by processing client data close to the source. The edge combines serverless functions and CDNs, allowing for server-side logic execution without web server configuration. Use cases for the edge include personalization, geolocation-based content delivery, AV testing, and implementing security logic.

1. Introduction to Edge and CDNs

Short description:

Today we will talk about the Edge and how websites were created in the 90s. Websites worked by sending a request to a web server, which generated and sent the content back. However, this approach had issues with server overload and performance due to the server's location and multiple users accessing it. To solve this, content delivery networks (CDNs) were introduced. CDNs are geographically distributed servers that bring web content closer to users, improving delivery speed.

Hello, everyone. My name is Facundo, and today we will talk about the Edge. First of all, I want to introduce myself. As I said, my name is Facundo, Facundo Giuliani. I'm from Argentina. I'm a Developer Relations Manager. I'm the manager of the Developer Relations Team at Storyblok. I'm also one of the organizers of React Buenos Aires. React Buenos Aires is the biggest React community in Argentina, and we organize monthly meetups, and I'm also one of the organizers of Dev Summit Argentina, another community of developers in the country.

So for today I wanted to start a little bit with some 90s vibe. I wanted to discuss how the websites were created when they looked like this one, the Space Jam website. If you go to the Internet, you can see that it's still up and running and it's looking like this. But at this time in the 90s, the websites worked and they still work in this way. You have a web browser in your mobile device or your computer. You send a request to a web server, that web server executes the request, generates the content, and then it sends the content to you after processing your request and generating all the data and the content that you need to see the page that you are requesting. Actually, this web server is an actual computer living somewhere in the world. So this is an image from the past, from the 90s, but it used to be like this. I mean a computer that if you turn off, that computer, your website is not up and running anymore, so you need to be careful with the wires and things like that. But, yeah, I mean, that's the basic way of working of a web server and the websites. This way of working has an issue, although, and the issue is that we have our web server in one unique location where the people is sending their request and expecting that web server to process their request and send the data. What it means is that if we have multiple people, let's say thousands of people requesting the content or sending at the same time, we may be overloading this web server. And not only that, another thing that we have to consider is that these requests that we are sending from any part of the world, we have to travel to this unique location where the web server is located. And then all that time that it takes to get from your location to the web server, it will affect the performance and the load time of your web page. So that those are some issues that a basic server-side rendering logic has. The multiple people accessing to the same web server, and also the different parts of the world where that people is requesting the page.

So in order to solve this scenario, or in order to see a solution for this particular use case, after the year's new concept was defined, the concept of content delivery network, this is a group of geographically distributed servers that helps you to speed up the delivery of web content, bringing that content closer to where the users are. So basically, what we have with these CDNs, as they are called, is we have different servers, like the web servers that we were mentioning before. We have different web servers in different parts of the world and these web servers are improved to deliver static content to the users. So basically, what we will have in these different nodes, as they are called in this network, are static assets like images, videos, but also HTML files, CSS files and JavaScript files. So they are going to be host and cached in these different nodes of our network.

2. Introduction to CDNs and the Edge

Short description:

When a user requests resources, the request travels to the closest node of the network, reducing bandwidth consumption and improving performance. CDNs work with static assets, requiring an origin server for dynamic content. The concept of the edge addresses the limitations of CDNs, processing client data close to the source. Edge networks have different origin servers in various locations, replicating the origin server and processing requests from users. The edge is not the same as a serverless function, as it offers benefits like managed servers and pay-as-you-go pricing.

And when a user wants to request one of these resources, the request that they are sending will travel to the closest node of the network. So let's say that I live in Argentina and I have one of the nodes of this network in Brazil. Instead of sending my request and having to go to a web server located in the UK, let's say, my request will travel to the Brazil node of the network and then I will get all the resources from that node. This helps to reduce the bandwidth consumption because we won't be accessing all the users or all the visitors to the same web server, and we will have a better performance because of this and because of the request having to travel less, let's say, going to the closest node of the network. I mean, depending on your location, depending where the network has these nodes, and there will be more security because instead of accessing to the origin of the data or the content, your request will travel to different nodes without having to know which is the actual web server that is hosting your website.

Because one thing that I mentioned and you have to consider is that these CDNs, they work with static assets. That means that if we need to generate dynamic content or dynamic assets, or we need to generate these assets dynamically, somehow based on a logic that depends on the user, we will still need the origin server to do that. So as I was mentioning, these CDNs work with static content. That's why a new term was developed with the ERs, the static site generation. You may be familiar with frameworks like Gatsby or NGJS where you can generate static assets at build time, JavaScript files, CSS files and HTML files. The idea of this is that you are able to create a website that can be host in these CDNs, so you don't depend on an origin server. And having the same idea in mind, the concept of the JAMstack was developed, where the idea was to focus most of the logic of your websites on the static assets and managing the dynamic data with different approaches like APIs, serverless function, or small pieces of code that is running server side, but not your whole website living on the web server or having to wait for each request to be processed to return or deliver this content. But as you can see, there there's another issue now. And the issue is that we can only manage static content with the CDNs. So as I was mentioning before, if we need some dynamic data, or we need to generate a certain asset, that is not living or is not cached on the nodes of the CDN, we will have to send the request to the origin server. And there's where the performance issues start to appear again. We are lacking the security and the performance that we have with a CDN.

So having this issue in mind and other ideas and approaches and always trying to improve the situation, of course, the IT industry came up with a new concept, the concept of the edge. The edge is basically a distributed network architecture where the client data is processed as close to the originating source as possible. So that means that if we will use some data coming from our users or some context from our users, we can grab that context as close as possible from them the server-side logic closer to them, instead of having to send the request and all that information to an origin server and wait for the processing. So in this case, what we will have is basically using the same distribution that we had for a CDN, we will have different origin servers in the different locations. So if I need to process data coming from the users and I have a user from Argentina wanting to request a certain resource or sending a request, that request will be processed in the closest node of my edge network, which in this case could be again, Brazil, let's say, instead of having to send that request to one unique origin server that is living in a particular location of the world. So in this case, we will have our origin server replicated in different parts of the world, processing all the requests that are coming from the different users. One thing that you have to keep in mind is that when we are talking about the edge, it's not the same the edge as a serverless function, because even though that we will have some of the benefits that we have with the serverless functions, like we won't need DevOps because the servers are going to be managed by the provider and we are only going to pay for what we use. I mean, instead of having to pay for a dedicated web server, we will have our processing time defining how much we are going to pay for that. So that means that we won't have under utility of the web servers because the only processing that we will have is when the requests are coming and are being processed and executed. I mean, all of these are aspects that we can identify and consider on serverless functions. The thing is that the Edge is not only this because a serverless function can be deployed to a centralized web server. And if that's the case, we are going to have the same issue that we had before with the origin server. I mean, the unique origin server.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Nuxt on the Edge
Vue.js London 2023Vue.js London 2023
30 min
Nuxt on the Edge
Nuxt is a web framework with many features including server-side rendering, client-side rendering, static site generation, edge site rendering, and more. The Edge is a limited environment running on CDN nodes, such as Cloudflare network. Database options on the Edge include Postgre with Neon, Versel on Neon, Superbase, MySQL with plan scale, HyperDB, and KV with redis and Cloudflare storage. The speaker demonstrates creating a demo with a votes table, handling API requests, adding authentication, saving votes, and displaying results. The roadmap to a full stack Nuxt 3 with an edge-first experience is in progress. Copilot is a helpful tool for developers. Integrating SSO with GitHub and improving the developer experience are important considerations for Nuxt 3.
Deno 2.0
Node Congress 2023Node Congress 2023
36 min
Deno 2.0
Top Content
The Talk discusses forced optimization with Node and Deno, with Deno aiming to pursue the same goals in a more expansive and modern way. Deno has built-in support for NPM and enforces security constraints. It also has a key-value database called Deno KV, which will be a core part of the Deno 2 API. Deno Deploy is a serverless Edge Functions platform powered by FoundationDB, optimized for fast reading and ideal for building eCommerce sites or application servers at the edge. Deno 2.0 is coming soon with more features under development.
Static first websites with Cloudflare Workers
Node Congress 2022Node Congress 2022
30 min
Static first websites with Cloudflare Workers
The Talk covers the historical landscape of web development, the rise of static site generators, the serverless revolution, edge computing, and using Cloudflare services to enhance static websites. It explores the challenges of early web development, the shift to static sites and client-side rendering, and the advantages of server-side and client-side rendering. It also discusses Cloudflare services like Cloudflare workers, KV, durable objects, and HTML rewriter for building fast and minimal hosting solutions. The Talk highlights the use of DurableObjects for analytics and integration, dynamic content on static sites, JAMstack, and the advantages of using Cloudflare Workers for automatic deployment, multiple language support, and combining static pages with JavaScript functions. It introduces the concept of edge computing and the difference between Cloudflare Pages and Workers. It also touches on error handling and the use of HTML rewriter, Cloudflare KVstore, and DurableObjects for managing state and storing dynamic data.
Building full-stack applications on the Edge
React Advanced Conference 2022React Advanced Conference 2022
9 min
Building full-stack applications on the Edge
This Talk explores building full stack applications on the edge and the blurring line between front end and back end development. It discusses the benefits of using the JAMstack and APIs for scalable web development. The Talk also highlights the improvements in edge technology, such as serverless functions and efficient data storage, and the deployment of functions and durable objects on the edge network. Overall, the Talk emphasizes the importance of delivering high-quality experiences with low latency through edge computing.
The Edge & Databases: Everything Everywhere All at Once
Node Congress 2023Node Congress 2023
26 min
The Edge & Databases: Everything Everywhere All at Once
This talk discusses working with databases on the Edge, the challenges of serverless and databases, and the challenges of working with databases on the Edge. It explores solutions such as using proxy connections and globally replicated data stores. The talk also highlights the use of Prisma for caching data and the considerations for edge migration. Additionally, it mentions the caching strategy with SWR and the availability of edge solutions for caching.
The New Frontier: E-Commerce at the Edge
Remix Conf Europe 2022Remix Conf Europe 2022
19 min
The New Frontier: E-Commerce at the Edge
Today's Talk discusses the new frontier of e-commerce at the edge, focusing on headless commerce and the benefits it offers. The edge, an intermediate server, can improve website loading by rendering HTML on the server and reducing latency. Venger, an open-source headless e-commerce framework, is introduced as a solution to cache API responses at the edge and improve performance. The Venger online shop demonstrates excellent performance, highlighting the benefits of headless and edge computing in e-commerce.

Workshops on related topic

Unveiling Next.js Secret Sauce on the Edge
React Summit 2024React Summit 2024
48 min
Unveiling Next.js Secret Sauce on the Edge
Workshop
Mustafa Azim
Mustafa Azim
Next.js on the Edge with its new secrets sauce for better user experience and high performance. We will unveil Next.js secret sauce and the way of working to deliver the best user experience in Edge network and the new features including partial pre-rendering. How to make use of the Server component and its high performance on Edge network.
Table of the contents:- Intro to the Edge network- Edge runtime in V8- Use cases of the edge functions- Deploy a service on the edge network