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 Day Berlin 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 Storyblok, an organizer of React Buenos Aires, and Dev Summit Argentina.

A CDN is a network of geographically distributed servers that speeds up the delivery of content by bringing it closer to users, reducing bandwidth consumption, improving performance, and enhancing security by serving static content such as HTML, CSS, and JavaScript files.

CDNs improve website performance by hosting content on multiple servers worldwide, allowing users to access data from the closest server location, which significantly reduces the load time of pages.

Static content refers to files that don't change, like HTML, CSS, and JavaScript, while dynamic content is generated in real-time based on user requests and can vary from one user to another.

Edge networks evolve from traditional CDNs by integrating the capability to process dynamic content close to the user, enhancing performance, security, and providing real-time data insights and easier scalability.

Edge computing offers better performance, enhanced security, real-time insights, and easy scalability. It allows for personalized content delivery, geolocation services, A-B testing, and dynamic authentication and authorization.

Edge functions in NetJS are serverless scripts that execute server-side rendering across different regions without requiring server maintenance, optimizing content delivery on the Edge network.

Frameworks like NetJS use Edge functions for server-side rendering, while Remix allows for dynamic control based on user routes, supporting different runtimes like node, DH, and GNO, enhancing the flexibility of deployments in Edge architectures.

Facundo Giuliani
Facundo Giuliani
11 min
12 Dec, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today's Talk introduces the concept of the Edge and Content Delivery Networks (CDNs), which bring content closer to users, improving performance and security. The Talk also discusses Edge Computing and Distributed Hosting (DH), which processes client data closer to the source for faster delivery of dynamic content. The use of DH offers benefits such as better performance, security, real-time insights, and scalability. The Talk concludes with an overview of Edge concepts, including server-side rendering logic and custom middleware for each request.

1. Introduction to the Edge and CDNs

Short description:

Hello everyone. Today we will talk about the Edge. The concept of the Edge is about evaluating how things used to be in the past and how they are now. When we browse a page, we send a request to a web server, which generates an HTML document. However, this can cause issues such as server overload and slow load times. To address this, Content Delivery Networks (CDNs) were developed. CDNs are geographically distributed servers that bring content closer to users, reducing bandwidth consumption and improving performance and security. CDNs deliver static content and have led to the concept of static site generation.

Hello everyone. My name is Facundo, and today we will talk about the Edge. First of all, I wanted to introduce myself. As I said, my name is Facundo, Facundo Giuliani. I'm from Buenos Aires, Argentina. I'm a Developer Relations Engineer at Storyblok. I'm also one of the organizers of React Buenos Aires, the biggest React community in Argentina. We run local meetups every month in the city. I'm also one of the organizers of Dev Summit Argentina, another developer community here in the country. So if you are around, let me know.

So before starting with the actual concept of the Edge, I wanted to introduce it. Evaluating or like reviewing how the things used to be in the past. So I mean, not only in the past, but nowadays, too, whenever we request a page or we are browsing a page from our browser, let's say in our mobile phone or our computer, what we do is we send the request to a web server. In the case of the original way the things used to be, the web server would process my request and will generate an HTML document that will deliver to my browser so I can see the page that I want to visit. The thing is that this request is being processed for every user that is requesting the page and that wants to visit the page, which can be okay, but it can also bring some issues. The issues are that if we have multiple people requesting the same page we will be overloading the server that is generating the content and the HTML documents. And not only that, we are also depending on where that web server is located. So the users will send the request, the request will travel to the specific location where that server is, and then we will have to wait for the HTML document to come back to your browser, let's say.

So if I have a web server located in Australia, because that's where my website is host, and I'm visiting from Argentina, my request will have to travel from Buenos Aires to Australia. And that, I mean depending on the distance that the request is traveling, it will affect the load time of my page. So having these couple of issues in mind, a new concept was developed with the years, which is the Content Delivery Network or CDNs, and these CDNs are a group of geographically distributed servers that speed up the delivery of content because we are bringing the content closer to the users. So basically a CDN is a network of servers that are called nodes, these nodes are going to replicate the content on each one of the locations of the different servers and the request from the users will travel to the closest node to get the content instead of having to go to a particular location or a particular web server. So in the same example that I mentioned before, if I have a CDN node in Brazil, let's say, my request instead of having to go to Australia and bring back the HTML page that I'm requesting it would travel to Brazil and get the same content. The benefits that the CDNs are bringing are that we are reducing the bandwidth consumption because we are not sending all the requests to the same web server. On the other hand, we would have better performance because of this reason and because of the reason of what I said, the request not having to go to one particular location in the world. And on the other hand, we will also have more security because the users won't be requesting the content to the specific web server that is generating the content, but they are going to request to the closest node that is hosting the specific content that we want to deliver. And when I say specific content, it's because the CDNs or the node the server nodes from the CDNs are improved to deliver static content. They can deliver static assets like HTML files, CSS files or JavaScript files. And that brought the attention a new concept called static site generation. Basically, it is about creating a website that is being generated and built during the process that we run to generate the static version of the different pages of our website.

2. Edge Computing and DH

Short description:

So what we do is run a build process to generate static pages with assets for hosting on CDNs. However, CDNs are designed for static content. To handle dynamic content, we have origin servers on CDNs. To address this, a new concept called DH was developed. DH is a distributed network that processes client data closer to the source, delivering dynamic content faster. DH offers benefits such as better performance, security, real-time insights, and scalability. It enables personalization, geolocation, A-B testing, and security management. React-based frameworks like Next.js provide Edge functions, serverless scripts for server-side rendering.

So what we do is basically run this build process and it will generate all the pages of my website in a static form with static assets like HTML files, CSS files, and JavaScript files. And we can use that to host our website and use it and get the advantage of the CDNs.

But probably you are seeing here the issue and the issue is that the CDNs are planned to deliver static content. So what happens when I have dynamic content that needs to be generated for a particular user with particular conditions and for a particular request that is coming? Let's say I need to process one particular request and send content based on that request. If that's the case, we still have what we call an origin server on our CDN. This origin server is like the web server that we mentioned before that will process each request and will deliver the content or will deliver the result of the processing. But the thing is that again, this CDN, this network, has only one origin server, so if I'm requesting static content, it's fine. I can get it from the closest node from the network, but if I need dynamic content, I have to send the request to one particular origin server, and we are having the same issue that we had before.

So with this concept in mind, and after the web servers evolving and having new features and having new possibilities, a new concept was developed which is the concept of DH. DH is basically a distributed network, like the one that we have for the CDNs. But in this case we have an architecture where we are processing the client data as close to the source of that data as possible. So DH is basically evolving the CDNs to having origin servers, or kind of origin servers, let's say, where we have the CDN nodes. So besides delivering static content from our CDN nodes, we are also going to be able to process data and based on the dynamic processing or the server side logic that will process the data coming from the customers, we will be able to deliver dynamic content to them faster because we are doing it closer to the source of the data, which are the users.

So as you can see, we have some of the main benefits that we have also for CDNs which are better performance, more security, but we also are going to have real time insights and easy scalability because we can add more edge servers, as they are called, to our network and we will be able to process requests from more users from different locations. So these edge networks, some of the main use cases that we can solve with edge computing, let's say or an edge network are personalization. We can evaluate the request of the users. And based on certain parameters that we are defining, we can return a certain content or a different content. We can also apply geolocation based on the location of the user that is visiting our website. We can return certain content or show a particular part of our web page. We can also implement A-B testing strategies of A-B testing if we are evaluating to release a new campaign on our website. Using this dynamic processing of the request we can show a particular version of the content or the other. And finally, we can also manage the security. We can apply authentication or authorization dynamically and we can evaluate which users are visiting our website. And based on that, show particular content, show validation, some things like that.

So as we are discussing the concept of the Edge, which is also tied to the web provider or the web server that we are going to use or the hosting provider that we are going to use to host our website. We also have to keep in mind the framework that we are going to use to create the code and the application itself that will be host on the Edge. As we are in React Berlin I will mention how a couple of React based frameworks are managing the concept of the Edge and the features that they offer us to manage that. One of the frameworks is NetJS. NetJS offers what they call Edge functions, which are basically serverless scripts. I mean scripts that you don't have to worry about the maintenance of the web server that are executed server-side, I mean they execute server-side rendering that can be distributed to different regions.

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