Art & Entropy: Introducing Chaos to Your Frontend

Rate this content
Bookmark

Chaos Engineering is a current trend which involves studying the behavior of a system in the face of external events that are often unlikely, but in this case provoked (server or load-balancer crash, loss of DNS, etc.).

The disorder thus generated provides a wealth of information on how our systems work, enabling us to improve their robustness.

But strangely enough, all the books, talks and tutorials on Chaos Engineering overlook an important component of our systems. And yet, if there's one area where unpredictability, inconsistency and the need for resilience are central concerns, it's the frontend.

💥Chaos, frontend, and Japanese ancestral art 👘: 3 notions that at first glance have nothing in common, but which together open up new perspectives in the development of our applications.

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

FAQ

Kintsugi is the ancient Japanese art of repairing ceramics and porcelain using gold-sprinkled lacquer. It treats breakage and repair as part of an object's history, rather than something to be disguised.

Kintsugi has evolved from its origins in the 15th century Japan to blend with contemporary art. Examples include the work of Jan Forman, who uses Legos to repair walls, and Raquel Susman, who uses gold lacquer to repair asphalt.

Chaos engineering is a practice, invented by Netflix in 2011, that involves intentionally disturbing a system to observe how it reacts and to identify weaknesses. It aims to improve system resilience by learning through controlled experiments.

Netflix regularly crashes parts of its infrastructure, sometimes several times a day, to ensure that everything is working properly. This practice has led them to develop highly advanced automated restoration processes.

The benefits of chaos engineering include discovering and identifying system weaknesses, gaining a better understanding of interdependencies, building confidence in system stability, and implementing disaster recovery protocols.

Yes, chaos engineering can be applied to frontend development, although it is less common. The goal is to ensure that the frontend remains resilient and functional despite disruptions, similar to how backend chaos engineering is practiced.

Methods to create disruptions in a frontend application include simulating slow or failed HTTP requests, using pseudo localization to test language handling, manipulating timers, and altering navigation history. These can help identify potential weaknesses in the frontend.

Pseudo localization is a method that replaces text with an altered version containing more letters and characters while remaining readable. It helps developers test how their applications handle different languages and text lengths.

The chaos frontend toolkit is a browser extension and NPM library created to help developers experiment with chaos engineering in the frontend. It includes various tools to simulate disruptions and test the resilience of web applications.

Implementing chaos engineering in production for frontend applications is challenging because the disruptions are more visible to users. It is generally better suited for test and staging environments.

Thibaud Courtoison
Thibaud Courtoison
16 min
18 Jun, 2024

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Welcome to the talk, Art & Entropy, Introducing Chaos in Your Front-End. Chaos engineering is a practice invented by Netflix in 2011 to observe how a system reacts to intentional disturbance. Applying chaos engineering to the frontend is experimental but necessary, as a broken frontend can negatively impact the user experience. Intentional perturbations in the frontend can be induced through various areas such as HTTP requests with slow 3G network or unstable Wi-Fi. Tools like chaos frontend toolkits can be used to experiment with chaos engineering in the frontend and embrace breakage as part of the application's story.

1. Art & Entropy: Introducing Chaos in Your Front-End

Short description:

Welcome to the talk, Art & Entropy, Introducing Chaos in Your Front-End. Have you heard of Kintsugi? It's the ancient Japanese art of repairing ceramics and porcelain using gold-spinkled lacquer. In the early days of Kintsugi, collectors would intentionally break their own ceramics and have them repaired. Kintsugi can depart from its original medium to adapt to a new sport. Is our web app perfect, bug-free, on all browsers, in all responsive sizes? No. But does it need to be perfect? No, it just needs to be resilient, to work no matter what. We are going to use chaos engineering to make sure that our apps are resilient. Chaos engineering is a practice invented by Netflix in 2011. The aim is to observe how a system reacts to intentional disturbance. The benefits of chaos engineering include discovering and identifying weaknesses in a controlled environment and understanding the interdependencies of the components of our systems.

Hi everyone, and welcome to the talk, Art & Entropy, Introducing Chaos in Your Front-End. My name is Thibaut, and you can find me on Twitter with the hero name Pseudo. Let's get started.

Have you heard of Kintsugi? It's the ancient Japanese art of repairing ceramics and porcelain using gold-spinkled lacquer. As a philosophy, Kintsugi treats breakage and repair as part of an object's history, rather than something to be disguised. In the early days of Kintsugi, around the 15th century in Japan, collectors were so fond of the rendering that they would intentionally break their own ceramics and have them repaired. Over the years, Kintsugi has evolved and blended with contemporary art. Examples include the work of Jan Forman, who uses Legos to repair walls in the urban landscape, but also the work of Raquel Susman, who uses gold lacquer to repair asphalt. In this way, Kintsugi can depart from its original medium to adapt to a new sport. A new sport, and why not the web?

Because yes, let's ask ourselves. Is our web app perfect, bug-free, on all browsers, in all responsive sizes? No. But does it need to be perfect? No, it just needs to be resilient, to work no matter what. It can be broken and functional, broken and beautiful, like ceramics repaired with Kintsugi. Sounds good. So, how do we make sure that our apps are resilient? Well, we are going to use chaos engineering to do just that. Maybe you've heard the term before. Invented by Netflix in 2011, this practice draws parallels in science with chaos theory, which is a study of the evolution of the entropy disorder in a system. The aim is to observe how a system reacts to intentional disturbance. For example, intentionally crashing a server, and watching how the infrastructure reacts. Will it pass requests onto other servers? Will it restart a server and redirect traffic? How quickly? Basically, we break stuff and then we watch. The good thing is, instead of waiting for things to blow up, to check that our infrastructure will hold up, we do it ourselves. And that's how we improve, by learning how our infrastructure reacts to chaos.

And where it reaches the next level is, at Netflix, they do that in production. They crash their infrastructure regularly, sometimes several times a day, to make sure that everything's working properly. And this has prompted them to set up highly advanced automated restoration processes, to the point where they are able to restart entire regions of the infrastructure in just a few seconds, without human intervention. These are the benefits of chaos engineering. First of all, it will help us discover and identify weaknesses in a controlled environment. We know what we broke, so we can reverse-fix it easily if things go sideways during the experiment. It will also give us an increased understanding of the interdependencies of the components of our systems. Interdependencies.

2. Applying Chaos Engineering to the Frontend

Short description:

In a previous company, we discovered the interdependencies of our system when an unresponsive infrastructure caused user login requests to stack indefinitely. The benefits of chaos engineering include confidence and implementing a disaster recovery protocol. Applying chaos engineering to the frontend is experimental but necessary, as a broken frontend can negatively impact the user experience. Chaos engineering is applied in four steps: defining the nominal state, making a hypothesis, creating perturbations, and comparing states. Creating disruptions on the frontend can be done through various areas, such as HTTP requests with slow 3G network or unstable Wi-Fi.

For example, in a previous company, we had an old legacy server which was generating PDFs, but also, and everyone had forgotten at the time, JYP lookups for security purposes. And one day, the infrastructure on which this server was became unresponsive. They started a chain reaction where user login requests, which relied on JYP, also became unresponsive. And that's when we realized that there were no defined timeouts on those calls, which, in turn, means that user login requests were stacking indefinitely, therefore, deducing our entire infrastructure. And, unfortunately, that's how we rediscovered the interdependencies of our system.

The third benefit of chaos engineering is confidence. Would you rather wait to be called at 7am on a Sunday morning because your application is down, or would you rather break it yourself on a Tuesday in the early afternoon and see that everything is working all right and that you can sleep peacefully on the weekend? And finally, it will force us to implement a disaster recovery protocol. We won't wait for an accident to happen before we think about solutions.

The thing is, in all the resources that exist on the subject of chaos engineering, books, documentation, it's all about infrastructure. So, I said to myself, why not apply it to frontend this time, because no matter how resilient your infrastructure is, how many load balancers you have, how many redundancies you have, if your frontend is broken, the users don't care. Their whole experience on your app will be negative. So, as I said, there are no resources on the subject of chaos engineering applied to frontend, nor are there any all-in-one tools or toolboxes for doing so. So, what comes next in this talk is experimental. Let's see how far we can push this subject. Let's start with the basics of chaos engineering.

It is applied in four steps. First, we'll define the nominal state of our system. For example, the user is able to log in, the user is able to watch the last season of The Witcher. Second, we'll make an hypothesis. We'll assume the continuity of the nominal state during the experiment. The user is still able to log in, the user is still able to watch the last season of The Witcher, and we will use two groups for that, control group and test group. And third, intentionally create a perturbation reproducing a real event, for example, a server crash. And finally, we'll compare the states of the two groups and we will try to disprove the hypothesis put forward earlier. Are our users still able to log in and watch the last season of The Witcher? If they don't, then we just identified a flaw in the resiliency of our system. Our aim is to apply this chaos engineering experiment to the frontend. For steps one, two, and four, it's not too different from classic chaos engineering. So we are going to look into step three and how we can create disruptions on the frontend. So there are a few areas of perturbations that we can see. The first one is HTTP requests. It can be in the form of slow 3G network, unstable Wi-Fi, unresponsive CDN, etc.

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

Don't Solve Problems, Eliminate Them
React Advanced Conference 2021React Advanced Conference 2021
39 min
Don't Solve Problems, Eliminate Them
Top Content
Kent C. Dodds discusses the concept of problem elimination rather than just problem-solving. He introduces the idea of a problem tree and the importance of avoiding creating solutions prematurely. Kent uses examples like Tesla's electric engine and Remix framework to illustrate the benefits of problem elimination. He emphasizes the value of trade-offs and taking the easier path, as well as the need to constantly re-evaluate and change approaches to eliminate problems.
Jotai Atoms Are Just Functions
React Day Berlin 2022React Day Berlin 2022
22 min
Jotai Atoms Are Just Functions
Top Content
State management in React is a highly discussed topic with many libraries and solutions. Jotai is a new library based on atoms, which represent pieces of state. Atoms in Jotai are used to define state without holding values and can be used for global, semi-global, or local states. Jotai atoms are reusable definitions that are independent from React and can be used without React in an experimental library called Jotajsx.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
The Epic Stack
React Summit US 2023React Summit US 2023
21 min
The Epic Stack
Top Content
Watch video: The Epic Stack
This Talk introduces the Epic Stack, a project starter and reference for modern web development. It emphasizes that the choice of tools is not as important as we think and that any tool can be fine. The Epic Stack aims to provide a limited set of services and common use cases, with a focus on adaptability and ease of swapping out tools. It incorporates technologies like Remix, React, Fly to I.O, Grafana, and Sentry. The Epic Web Dev offers free materials and workshops to gain a solid understanding of the Epic Stack.
Fighting Technical Debt With Continuous Refactoring
React Day Berlin 2022React Day Berlin 2022
29 min
Fighting Technical Debt With Continuous Refactoring
Top Content
This Talk discusses the importance of refactoring in software development and engineering. It introduces a framework called the three pillars of refactoring: practices, inventory, and process. The Talk emphasizes the need for clear practices, understanding of technical debt, and a well-defined process for successful refactoring. It also highlights the importance of visibility, reward, and resilience in the refactoring process. The Talk concludes by discussing the role of ownership, management, and prioritization in managing technical debt and refactoring efforts.
AHA Programming
React Summit Remote Edition 2020React Summit Remote Edition 2020
32 min
AHA Programming
Top Content
The Talk discusses the concept of AHA programming, which emphasizes thoughtful abstractions. It presents a live-coded example of the life-cycle of an abstraction and demonstrates how to fix bugs and enhance abstractions. The importance of avoiding complex abstractions and the value of duplication over the wrong abstraction are highlighted. The Talk also provides insights on building the right abstractions and offers resources for further learning.

Workshops on related topic

React, TypeScript, and TDD
React Advanced Conference 2021React Advanced Conference 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Web3 Workshop - Building Your First Dapp
React Advanced Conference 2021React Advanced Conference 2021
145 min
Web3 Workshop - Building Your First Dapp
Top Content
Featured WorkshopFree
Nader Dabit
Nader Dabit
In this workshop, you'll learn how to build your first full stack dapp on the Ethereum blockchain, reading and writing data to the network, and connecting a front end application to the contract you've deployed. By the end of the workshop, you'll understand how to set up a full stack development environment, run a local node, and interact with any smart contract using React, HardHat, and Ethers.js.
Remix Fundamentals
React Summit 2022React Summit 2022
136 min
Remix Fundamentals
Top Content
Featured WorkshopFree
Kent C. Dodds
Kent C. Dodds
Building modern web applications is riddled with complexity And that's only if you bother to deal with the problems
Tired of wiring up onSubmit to backend APIs and making sure your client-side cache stays up-to-date? Wouldn't it be cool to be able to use the global nature of CSS to your benefit, rather than find tools or conventions to avoid or work around it? And how would you like nested layouts with intelligent and performance optimized data management that just works™?
Remix solves some of these problems, and completely eliminates the rest. You don't even have to think about server cache management or global CSS namespace clashes. It's not that Remix has APIs to avoid these problems, they simply don't exist when you're using Remix. Oh, and you don't need that huge complex graphql client when you're using Remix. They've got you covered. Ready to build faster apps faster?
At the end of this workshop, you'll know how to:- Create Remix Routes- Style Remix applications- Load data in Remix loaders- Mutate data with forms and actions
Vue3: Modern Frontend App Development
Vue.js London Live 2021Vue.js London Live 2021
169 min
Vue3: Modern Frontend App Development
Top Content
Featured WorkshopFree
Mikhail Kuznetcov
Mikhail Kuznetcov
The Vue3 has been released in mid-2020. Besides many improvements and optimizations, the main feature of Vue3 brings is the Composition API – a new way to write and reuse reactive code. Let's learn more about how to use Composition API efficiently.

Besides core Vue3 features we'll explain examples of how to use popular libraries with Vue3.

Table of contents:
- Introduction to Vue3
- Composition API
- Core libraries
- Vue3 ecosystem

Prerequisites:
IDE of choice (Inellij or VSC) installed
Nodejs + NPM
Developing Dynamic Blogs with SvelteKit & Storyblok: A Hands-on Workshop
JSNation 2023JSNation 2023
174 min
Developing Dynamic Blogs with SvelteKit & Storyblok: A Hands-on Workshop
Top Content
Featured WorkshopFree
Alba Silvente Fuentes
Roberto Butti
2 authors
This SvelteKit workshop explores the integration of 3rd party services, such as Storyblok, in a SvelteKit project. Participants will learn how to create a SvelteKit project, leverage Svelte components, and connect to external APIs. The workshop covers important concepts including SSR, CSR, static site generation, and deploying the application using adapters. By the end of the workshop, attendees will have a solid understanding of building SvelteKit applications with API integrations and be prepared for deployment.
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.