Monitorización del rendimiento de una aplicación heterogénea de GraphQL Mesh

Rate this content
Bookmark

Hoy en día es bastante fácil integrar GraphQL en el lado del cliente y del servidor y ponerlo en funcionamiento rápidamente con cualquier servicio en la nube de tu elección, como por ejemplo Netlify o Vercel. Con esta configuración, ¿cómo podemos monitorizar el rendimiento y observar todas las partes juntas para encontrar cualquier causa raíz en caso de problemas?

Robert Hostlowsky
Robert Hostlowsky
8 min
10 Dec, 2021

Video Summary and Transcription

La monitorización del rendimiento es crucial para las empresas, ya que a los usuarios no les gusta esperar. La herramienta ApolloEngine ayuda a rastrear y analizar métricas, revelando variaciones en el tiempo de respuesta y otra información. Instana combina trazas para la comunicación de servicios con métricas de infraestructura y monitorización de usuarios finales, implementando telemetría abierta. Apollo Studio es excelente para gestionar el esquema de GraphQL y proporciona una observabilidad completa, lo que permite un análisis eficiente de la causa raíz.

Available in English

1. Performance Monitoring and Issue Investigation

Short description:

Soy Robert Horslowski, un ingeniero de software en Instaun en la empresa IBM. Tengo experiencia con GraphQL y he encontrado problemas de rendimiento en aplicaciones de demostración en vivo. El monitoreo de rendimiento es necesario porque a los usuarios no les gusta esperar, y las APIs son cruciales para las empresas. Al investigar un problema real de rendimiento, descubrí que la comunicación con la base de datos a veces era muy lenta. La herramienta ApolloEngine ayudó a rastrear y analizar métricas, revelando variaciones en el tiempo de respuesta y otra información.

¡Hola a todos! Estoy muy feliz de estar aquí para tener la oportunidad de compartir mis pensamientos y aprendizajes sobre performance con GraphQL específicamente en un service mesh. Permítanme presentarme rápidamente. Soy Robert Horslowski, trabajo en Instaun en la empresa IBM y en 2016 di una charla sobre GraphQL en Relay. Más tarde, en 2018, publiqué este curso en video sobre un clon completo de trailer basado en GraphQL. Desde entonces, en 2019, encontré un sutil problema de rendimiento en esta aplicación de demostración en vivo que lo desencadenó todo.

Pero primero, sumerjámonos y veamos qué queremos decir con malla distribuida. Entonces, en realidad no tenemos solo un servicio, sino que típicamente nuestro panorama desde una infraestructura se ve así. Por supuesto, puede haber una o dos máquinas que se caigan, etc. Pero esto se maneja típicamente. Pero ¿qué sucede a nivel de servicio? Y aquí también, esto es típicamente cómo se ve una malla de servicios cuando lo examinas y tienes una representación del tráfico de la comunicación. Y también aquí, por supuesto, hay muchas comunicaciones en ejecución y esto típicamente no es visible si no tienes una herramienta así. Pero primero, hagámonos la pregunta, ¿por qué es necesario el monitoreo de performance? Sí, es bastante simple. A los usuarios no les gusta esperar. Y típicamente, cuando hoy en día tenemos un service mesh o al menos se utiliza algún servicio. Tal vez este sea un servicio para un servicio de pago o algo así. Y típicamente, otros servicios dependen de eso. Y esto debe ser rastreado de alguna manera. Y en caso de una falla, por supuesto, debe ser fácilmente encontrado y solucionado. ¿Por qué es esto importante? Típicamente, hoy en día, cuando las APIs son el centro de un negocio, por ejemplo, también aquí, es muy importante que los tiempos sean los esperados. Nadie quiere esperar por algo y luego descubrir que no fue su culpa, sino de otra persona. E incluso mientras puede haber existido un contrato, llamado SLA, donde defines que un servicio específico debe responder en algún momento. Y si no lo hace, ahí es donde alguien tiene un problema y el negocio tiene un problema al final. Pero vamos a investigar un problema real de performance. Como mencioné, tuve un problema con mi demostración en vivo en ese momento. Es un simple tablero Kanban con algunas transacciones de base de datos o un backend donde se almacenan algunos datos, por supuesto, pero también, en ese momento, la comunicación de la base de datos era gráfica. Entonces, por alguna razón, era muy lento, pero otras veces era muy rápido. No podía decir dónde estaba el problema, pero a veces era realmente muy lento, y solo había una herramienta disponible, o estaba allí, se llamaba ApolloEngine. Era bastante simple agregar una clave de API en el servidor de Apollo al usar la biblioteca del servidor de Apollo, y luego automáticamente rastreaba estas métricas y las mostraba aquí en el tablero. Entonces puedes ver aquí, esta es la variación, digamos, o el espectro de los tiempos de respuesta, hasta 13 segundos para una llamada, lo cual, por supuesto, no es aceptable, y hay más información como en el lado derecho,

2. Instana y Apollo Studio

Short description:

Hace un año, tuve la oportunidad de usar Instana, que combina trazas para la comunicación de servicios con métricas de infraestructura y monitoreo de usuarios finales. Implementa telemetría abierta. Para recopilar datos de usuario, inyecta el fragmento UEM en el sitio web. Es fácil rastrear las trazas del backend y analizar el recuento de consultas. También monitoreo mi aplicación que se ejecuta en funciones de Netlify usando el instanawrapper. El verdadero problema fue usar un backend de servicio GraphQL con un plan premium. Apollo Studio es excelente para administrar el esquema de GraphQL y proporciona una observabilidad completa, lo que permite un análisis eficiente de la causa raíz.

por lo que el número de consultas y demás. Esto fue hace un año. Mientras tanto, mejoraron su servicio y también tienen algún seguimiento incorporado, que también se puede habilitar muy fácilmente y para servicios freemium específicos también es bastante fácil y no cuesta nada. Pero esto, en ese momento, también me dio un poco de información y también tuve la oportunidad de usar Instana, e Instana combina estas trazas para la comunicación de servicios junto con métricas de infraestructura y también con UEM, es decir, monitoreo de usuarios finales. Y por cierto, implementa telemetría abierta, el último estándar en esta área. Entonces, ¿cómo llegamos allí? Es bastante simple al final. Finalmente, para obtener toda la información del usuario y lo que está haciendo el usuario, solo tienes que inyectar tu fragmento UEM en el sitio web, luego la consulta GraphQL puede recopilar todos los datos, incluso errores de JavaScript y demás. E incluso las solicitudes específicas se pueden encontrar aquí, y luego rastreando, encontramos algunas trazas del backend al final, también muestra la consulta GraphQL. Y en el lado derecho puedes ver alguna información adicional de la operación y demás. Y también podemos realizar más análisis sobre el recuento de consultas y demás. Pero en la actualidad, mi aplicación también se ejecuta en funciones de Netlify, que a su vez se ejecutan en AWS Lambda. Entonces, ¿cómo podemos rastrear eso? Es bastante fácil, solo usando aquí este instanawrapper. Y con esto, pude monitorear el servidor de aplicaciones Apollo aquí como vimos en la diapositiva anterior.

Entonces, finalmente, ¿cuál fue el problema real? Al final, descubrí que el verdadero problema era que en ese momento estaba usando un backend de servicio GraphQL que usaba este plan premium. Ese fue el único problema. En resumen, es bastante fácil. Apollo Studio es excelente para administrar el esquema de GraphQL, y se realiza como una observabilidad completa con todas estas características adicionales, y permite el desplazamiento hacia la izquierda para brindar a los desarrolladores un contexto completo de su aplicación en ejecución en producción. Esto también hace que sea muy eficiente encontrar cualquier causa raíz. Me gustaría decir, permítanme decir, muchas gracias por escuchar. Y para cualquier pregunta, por favor contáctenme en Twitter, en su hosts, o al correo electrónico robertoslofskaya.steiner.com. Y, por supuesto, espero verlos y conocerlos en el chat de la conferencia. Muchas gracias.

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

A Guide to React Rendering Behavior
React Advanced Conference 2022React Advanced Conference 2022
25 min
A Guide to React Rendering Behavior
Top Content
React is a library for "rendering" UI from components, but many users find themselves confused about how React rendering actually works. What do terms like "rendering", "reconciliation", "Fibers", and "committing" actually mean? When do renders happen? How does Context affect rendering, and how do libraries like Redux cause updates? In this talk, we'll clear up the confusion and provide a solid foundation for understanding when, why, and how React renders. We'll look at: - What "rendering" actually is - How React queues renders and the standard rendering behavior - How keys and component types are used in rendering - Techniques for optimizing render performance - How context usage affects rendering behavior| - How external libraries tie into React rendering
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Too much JavaScript is getting you down? New frameworks promising no JavaScript look interesting, but you have an existing React application to maintain. What if Qwik React is your answer for faster applications startup and better user experience? Qwik React allows you to easily turn your React application into a collection of islands, which can be SSRed and delayed hydrated, and in some instances, hydration skipped altogether. And all of this in an incremental way without a rewrite.
React Concurrency, Explained
React Summit 2023React Summit 2023
23 min
React Concurrency, Explained
Top Content
React 18! Concurrent features! You might’ve already tried the new APIs like useTransition, or you might’ve just heard of them. But do you know how React 18 achieves the performance wins it brings with itself? In this talk, let’s peek under the hood of React 18’s performance features: - How React 18 lowers the time your page stays frozen (aka TBT) - What exactly happens in the main thread when you run useTransition() - What’s the catch with the improvements (there’s no free cake!), and why Vue.js and Preact straight refused to ship anything similar
From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
We all love GraphQL, but it can be daunting to get a server up and running and keep your code organized, maintainable, and testable over the long term. No more! Come watch as I go from an empty directory to a fully fledged GraphQL API in minutes flat. Plus, see how easy it is to use and create directives to clean up your code even more. You're gonna love GraphQL even more once you make things Redwood Easy!
The Future of Performance Tooling
JSNation 2022JSNation 2022
21 min
The Future of Performance Tooling
Top Content
Our understanding of performance & user-experience has heavily evolved over the years. Web Developer Tooling needs to similarly evolve to make sure it is user-centric, actionable and contextual where modern experiences are concerned. In this talk, Addy will walk you through Chrome and others have been thinking about this problem and what updates they've been making to performance tools to lower the friction for building great experiences on the web.
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
How many times did you implement the same flow in your application: check, if data is already fetched from the server, if yes - render the data, if not - fetch this data and then render it? I think I've done it more than ten times myself and I've seen the question about this flow more than fifty times. Unfortunately, our go-to state management library, Vuex, doesn't provide any solution for this.For GraphQL-based application, there was an alternative to use Apollo client that provided tools for working with the cache. But what if you use REST? Luckily, now we have a Vue alternative to a react-query library that provides a nice solution for working with server cache. In this talk, I will explain the distinction between local application state and local server cache and do some live coding to show how to work with the latter.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Build with SvelteKit and GraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
140 min
Build with SvelteKit and GraphQL
Top Content
Featured WorkshopFree
Scott Spence
Scott Spence
Have you ever thought about building something that doesn't require a lot of boilerplate with a tiny bundle size? In this workshop, Scott Spence will go from hello world to covering routing and using endpoints in SvelteKit. You'll set up a backend GraphQL API then use GraphQL queries with SvelteKit to display the GraphQL API data. You'll build a fast secure project that uses SvelteKit's features, then deploy it as a fully static site. This course is for the Svelte curious who haven't had extensive experience with SvelteKit and want a deeper understanding of how to use it in practical applications.

Table of contents:
- Kick-off and Svelte introduction
- Initialise frontend project
- Tour of the SvelteKit skeleton project
- Configure backend project
- Query Data with GraphQL
- Fetching data to the frontend with GraphQL
- Styling
- Svelte directives
- Routing in SvelteKit
- Endpoints in SvelteKit
- Deploying to Netlify
- Navigation
- Mutations in GraphCMS
- Sending GraphQL Mutations via SvelteKit
- Q&A
Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced Conference 2022React Advanced Conference 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.