Pushing Boundaries To The Edge

Rate this content
Bookmark
Slides

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 2023, check out the latest edition of this React Conference.

Watch video on a separate page

FAQ

Facundo Giuliani is a developer relations engineer at Storyblock, based in Buenos Aires, Argentina. He is also an organizer of React Buenos Aires, the biggest React community in Argentina, and NodeConf Argentina.

The main issue with using a single web server is that it can lead to slower content delivery for users who are far from the server's location and potential server overload due to high traffic from simultaneous requests.

A Content Delivery Network (CDN) is a group of geographically distributed servers designed to speed up the delivery of web content by bringing it closer to users, thus improving access speed and reducing bandwidth issues.

CDNs improve content delivery by replicating data across multiple nodes or servers around the world, allowing users to access the content from the closest node, which reduces the load time and bandwidth use.

Edge computing in web development refers to a distributed network architecture where data processing is done close to the source of data or the users. This is used to minimize latency and bandwidth use, allowing for dynamic content generation near the user.

Edge computing allows for faster processing and delivery of dynamic content by executing server-side logic closer to the user. This can enhance personalization, enable geolocation-based content, support A/B testing, and bolster security measures.

Edge functions are scripts that can execute server-side rendering code within a CDN. They allow dynamic content generation close to the user, enhancing performance and user experience by reducing the load time.

Frameworks that support edge computing include Next.js, which offers edge functions, and Remix, which allows server-side logic to be executed on a per-route basis using either a Node.js runtime or an edge-oriented runtime.

Facundo Giuliani
Facundo Giuliani
9 min
06 Jun, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The Talk discusses the concept of the Edge and its role in content delivery networks (CDNs). CDNs are designed to improve the delivery of static content but cannot distribute dynamically generated content. Edge computing is a distributed network architecture that processes data close to the source or users, enabling personalization, geolocation-based dynamic content, AV testing, and content authentication. Frameworks like NexGIS, Bercel, Netlify, AWS, and Remix offer edge computing capabilities through edge functions or middleware, allowing execution of server-side logic closer to end users.

1. Introduction to Edge and CDNs

Short description:

Hello, everyone. My name is Facundo, and today we will talk about the Edge. A content delivery network is a group of geographically distributed servers that speed up the delivery of web content by bringing it closer to the users. CDNs are improved to deliver static content, but they can't distribute dynamically generated content.

Hello, everyone. My name is Facundo, and today we will talk about the Edge.

First of all, I want to do a quick introduction. My name is Facundo Giuliani. I'm from Buenos Aires, Argentina. I'm a developer relations engineer at Storyblock. I'm also one of the organizers of React Buenos Aires, which is the biggest React community in Argentina, and I also organized NodeConf Argentina, a big conference we are expecting to do this year.

So before starting or before going to the actual Edge concept, I wanted to do a recap on how we browse the web. So when we have a device, let's say a mobile phone or a computer, we request a web page to a web server and the web server returns the content that we are requesting. This content can be generated in different ways depending on the rendering method that we are using, but basically the web server will generate this HTML page and will deliver that to us. That will be the original approach of the web to distribute the content.

But this approach has an issue. The issue is that if we are using one web server, that web server is located in one particular location in the world, and we have all the users and all the visitors sending the request to that same web server at the same time to that particular location, which brings certain issues. One issue is that if we are far from that web server, that request will take more time to go to the server and then to return back the HTML page or the content, and not only that, we may be overloading that web server if we have many people visiting the website at the same time.

So to overcome that issue, a new concept or a new idea appear with the years, which is the content delivery network. A content delivery network is a group of geographically distributed servers. The idea of this group is to speed up the delivery of web content by bringing that content closer to the users. So basically, what we have in this case is this central web server that we mentioned before, but we have the content replicated in different nodes, as they are called, which are servers in different locations in the world. And then this network, the users can access to the content through the edge that is closer to them. So we will have people from different countries visiting the closest node of the network. So they will receive the content from those nodes instead of having to send their request to the unique server. There's an origin server that is called in this CDN, which is the server that is going to actually generate the content dynamically, but that is the source server, and then we have the replicated nodes inside the CDN.

Cool. So that's nice. That approach was used for static site generation, which is a method where we generate content at build time, and we have that available as static pages for the users that are visiting our website. Why? Because the CDNs are improved to deliver static content. So here we can see the issue. What's the issue? The issue is that the content that the CDNs can deliver is static. So if we want to generate content on the flight by the server, we can't use a CDN, because we can only distribute HTML pages, images, videos, all type of static assets or static content. We can use client-side rendering with React for instance, but we would be generating the content on the client-side.

2. Edge Computing and Frameworks

Short description:

The edge is a distributed network architecture that processes data close to the source or users, minimizing bandwidth. It enables personalization, geolocation-based dynamic content, AV testing, and content authentication. Frameworks like NexGIS, Bercel, Netlify, AWS, and Remix offer edge computing capabilities through edge functions or middleware, allowing execution of server-side logic closer to end users.

And that's something that if we want the server to generate that content to have a better performance, we can't do that. So to overcome those two scenarios or doing a mix of those two scenarios, we have the edge, which is a new concept and the idea of the edge is to have a distributed network architecture that processes the data as close as the source or the users to minimize this bandwidth that we were mentioning before.

So the idea is to replicate the server-side rendering on this original approach that we have, but closer to the users using the same approach that we use for the CDNs and also the same distribution of the edges and the different servers across the world.

So in this case, this is an example image from one of the examples of this edge networks. This is from AWS, but we will have CDNs with these servers that are hosting the static content, but in the same networks, in the same regional networks, we will have also edge computing servers that will execute server logic closer to the users.

So in this case, we can use the edge for different scenarios like personalization in the case that we want to send custom content to the different users. We can use geolocation to identify where the users are visiting our website from and create dynamic content based on that. We can implement approaches of AV testing in the case that we want to test different approaches on our projects, we can do that based on this dynamic content that we can generate with the edge computing. And then we can add authentication or security to the content of our websites. So we can manage static content but also dynamic content using the same edge network that we generated.

I will mention some of the frameworks that allows you to work with edge computer and as we are in a React conference, I will mention React frameworks. The first example that I wanted to mention is NexGIS. NexGIS offers edge functions which are basically scripts and functions that can execute server-side rendering code, so they are small pieces of code that can execute these functions on the edge with server-side rendering, but using the same network, or the same approach that we use for CDNs. In order to execute these functions you will need your hosting provider to allow you to do that.

The main hosting providers offer different approaches, but they offer edge computing like Bercel, Netlify, AWS, etc. We can also use what is called the middleware. The middleware is an intermediate layer or tier that can execute custom logic before a request is processed. In the case that you are using Next.js for static site generation and static content, you can catch all the different requests before you deliver the static content to the users, and then you can execute custom server-side logic before actually returning the content. So you can add custom content or you can add dynamic content to what you are returning to the user based on that.

And another framework, another React framework that we can mention is Remix. Remix's approach is basically focused on the server-side rendering, and they use what they call the Next.js Generation edge. So the idea with Remix is that you can choose between a Node.js runtime or an edge-oriented runtime on a per-route basis. So depending on the routes that you are going to manage on your website, you can execute server-side logic using a Node.js runtime or an edge function, or a worker, or, well, again, the different names that the different hosting providers offer you for this edge computing logic. So the idea is that you can execute server-side logic as close as possible to the end users that are visiting your website.

So thank you very much. Let's keep in touch, and we can continue talking about the edge or any other topic.