What is serverless computing? | Serverless definition

L'informatique sans serveur est une méthode qui fournit des services backend facturés sur la base de leur utilisation. Les serveurs sont toujours utilisés, mais une entreprise qui obtient des services backend d'un fournisseur sans serveur est facturée en fonction de l'utilisation, et non d'une quantité fixe de bande passante ou du nombre de serveurs.

Objectifs d’apprentissage

Cet article s'articule autour des points suivants :

  • Définir l'informatique sans serveur
  • Décrire les avantages de l'utilisation d'une architecture sans serveur

Copier le lien de l'article

Qu'est-ce que l'informatique sans serveur ?

Serverless computing is a method of providing backend services on an as-used basis. A serverless provider allows users to write and deploy code without the hassle of worrying about the underlying infrastructure. A company that gets backend services from a serverless vendor is charged based on their computation and do not have to reserve and pay for a fixed amount of bandwidth or number of servers, as the service is auto-scaling. Note that despite the name serverless, physical servers are still used but developers do not need to be aware of them.

Au début du Web, quiconque souhaitait créer une application Web devait posséder le matériel physique requis pour exécuter un serveur, ce qui est lourd et coûteux.

Then came cloud computing, where fixed numbers of servers or amounts of server space could be rented remotely. Developers and companies who rent these fixed units of server space generally over-purchase to ensure that a spike in traffic or activity will not exceed their monthly limits and break their applications. This means that much of the server space that gets paid for can go to waste. Cloud vendors have introduced auto-scaling models to address the issue, but even with auto-scaling an unwanted spike in activity, such as a DDoS Attack, could end up being very expensive.

Avantages du serverless

L'informatique sans serveur permet aux développeurs d'acheter des services backend sur une base flexible « payez au fur et à mesure », ce qui signifie que les développeurs ne doivent payer que pour les services qu'ils utilisent. Cela revient à passer d'un forfait de données de téléphone mobile avec une limite mensuelle fixe à un forfait qui ne facture que pour chaque octet de données réellement utilisé.

Le terme « sans serveur » est quelque peu trompeur, car il existe toujours des serveurs fournissant ces services backend, mais tous les problèmes d'espace serveur et d'infrastructure sont traités par le fournisseur. Sans serveur signifie que les développeurs peuvent faire leur travail sans avoir à se soucier du tout des serveurs.

Que sont les services backend ? Quelle est la différence entre le frontend et le backend ?

Le développement d'applications est généralement divisé en deux domaines : le frontend et le backend. Le frontend est la partie de l'application avec laquelle les utilisateurs voient et interagissent, telle que la disposition visuelle. Le backend est la partie que l'utilisateur ne voit pas. Il comprend le serveur où sont stockés les fichiers de l'application et la base de données où les données utilisateur et la logique métier sont conservées.

Frontend vs back-end d'une application

For example, let’s imagine a website that sells concert tickets. When a user types a website address into the browser window, the browser sends a request to the backend server, which responds with the website data. The user will then see the frontend of the website, which can include content such as text, images, and form fields for the user to fill out. The user can then interact with one of the form fields on the frontend to search for their favorite musical act. When the user clicks on ‘submit’, this will trigger another request to the backend. The backend code checks its database to see if a performer with this name exists, and if so, when they will be playing next, and how many tickets are available. The backend will then pass that data back to the frontend, and the frontend will display the results in a way that makes sense to the user. Similarly, when the user creates an account and enters financial information to buy the tickets, another back-and-forth communication between the frontend and backend will occur.

Quels types de services backend l'informatique sans serveur peut-elle fournir ?

Most serverless providers offer database and storage services to their customers, and many also have Function-as-a-Service (FaaS) platforms, like Cloudflare Workers. FaaS allows developers to execute small pieces of code on the network edge. With FaaS, developers can build a modular architecture, making a codebase that is more scalable without having to spend resources on maintaining the underlying backend. Learn more about FaaS >>

Quels sont les avantages de l'informatique sans serveur ?

  • Coûts réduits - L'informatique serverless est généralement très rentable. En effet, avec les fournisseurs cloud traditionnels de services backend (allocation de serveurs), l'utilisateur doit souvent payer pour l'espace ou le temps CPU inutilisés.
  • Passage à l'échelle simplifié - Les développeurs qui utilisent une architecture serverless n'ont pas à se préoccuper de politiques pour mettre à l'échelle le code. Le fournisseur d'informatique serverless gère le passage à l'échelle sur demande.
  • Code backend simplifié - Avec le FaaS, les développeurs peuvent créer des fonctions simples qui remplissent indépendamment un seul objectif, comme par exemple passer un appel API.
  • Délai d'exécution plus rapide - Une architecture serverless peut réduire considérablement les délais de commercialisation. Plutôt que de passer par un processus de déploiement compliqué pour mettre en œuvre des corrections de bugs et de nouvelles fonctionnalités, les développeurs peuvent ajouter et modifier le code de manière ponctuelle.

Learn more about the benefits of serverless computing.

How does serverless compare to other cloud backend models?

A couple of technologies that are often conflated with serverless computing are Backend-as-a-Service and Platform-as-a-Service. Although they share similarities, these models do not necessarily meet the requirements of serverless.

Backend-as-a-service (BaaS) is a service model where a cloud provider offers backend services such as data storage, so that developers can focus on writing front-end code. But while serverless applications are event-driven and run on the edge, BaaS applications may not meet either of these requirements. Learn more about BaaS >>

Platform-as-a-service (PaaS) is a model where developers essentially rent all the necessary tools to develop and deploy applications from a cloud provider, including things like operating systems and middleware. However PaaS applications are not as easily scalable as serverless applications. PaaS also don’t necessarily run on the edge and often have a noticeable startup delay that isn’t present in serverless applications. Learn more about PaaS >>

Infrastructure-as-a-service (IaaS) is a catchall term for cloud vendors hosting infrastructure on behalf of their customers. IaaS providers may offer serverless functionality, but the terms are not synonymous. Learn more about IaaS >>

What is next for serverless?

Serverless computing continues to evolve as serverless providers come up with solutions to overcome some of its drawbacks. One of these drawbacks is cold starts.

Typically when a particular serverless function has not been called in a while, the provider shuts down the function to save energy and avoid over-provisioning. The next time a user runs an application that calls that function, the serverless provider will have to spin it up fresh and start hosting that function again. This startup time adds significant latency, which is known as a ‘cold start’.

Once the function is up and running it will be served much more rapidly on subsequent requests (warm starts), but if the function is not requested again for a while, the function will once again go dormant. This means the next user to request that function will experience a cold start. Up until fairly recently, cold starts were considered a necessary trade-off of using serverless functions.

Cloudflare Workers has addressed this problem by spinning up serverless functions in advance, during the TLS handshake. Since Workers functions spin up at the edge in a very short amount of time, even shorter than the time required to complete the handshake, the result is an FaaS platform with zero cold starts. To get started with Cloudflare Workers, see our Developer documentation.

As more and more of the drawbacks of using serverless get addressed and the popularity of edge computing grows, we can expect to see serverless architecture becoming more widespread.