DEV Community

loading...

Tap Into GraphQL Resolver-Level Performance Metrics with nuQLeus

Daniel-P3
Software developer, member of nuQLeus
・3 min read

Alt Text

nuQLeus is a new open source development tool that enables developers to expose resolver-level performance metrics from GraphQL APIs running on either express-graphql or apollo-server. With the help of nuQLeus, developers can send queries and mutations to a GraphQL API, view the response, and quickly identify which specific resolver functions are most negatively impacting the application’s performance.

GraphQL Landscape

In recent years, GraphQL has reshaped how developers manage the flow of information between the front and backends of applications. HTTP data flow has traditionally been dominated by RESTful architecture; however, Facebook’s release of GraphQL in 2015 has since tipped the near ubiquitous adoption of RESTful architecture on its head. Many developers are now opting to deploy APIs with GraphQL implementation rather than RESTful architecture. GraphQL offers a plethora of benefits compared to the traditional RESTful alternative including: support for recursive queries, declarative data structures, ensures only the requested data is returned in the response, and seamless integration of multiple microservices and other external APIs into a single unified endpoint.

Nonetheless, GraphQL still has its own share of problems, particularly in performance testing. Since the implementation of GraphQL abstracts multiple network calls, routes, and middleware into a single network call, it can be difficult to access relevant metadata and as a result it is difficult to identify which resources are most negatively impacting application performance. This abstraction of metadata is one such reason why developers avoid adopting GraphQL.

Performance monitoring with REST is relatively straightforward, only requiring response time tests of an endpoint. GraphQL endpoints on the other hand, offer few insights into the health of a GraphQL API. The endpoint measurements will only calculate the response time based on the complexity and size of the queries, rather than measure performance based on repeated calls by the same query or mutation. Solving this problem requires tracing performance measurements of the resolvers themselves.

Resolvers are functions that acquire (or resolve) the data for a given query or mutation. Performance testing a GraphQL API requires paying attention to its resolvers, often the source of performance-based problems. This is where nuQLeus comes in.

What is nuQLeus

nuQLeus (released in beta version 0.1.0) is an open source development tool designed to help developers identify GraphQL performance issues by tracing resolver paths and visualizing response times. The tool is intended to be utilized on both new and existing code bases; in order to get started, install the nuQLeus npm package, wrap the nuQLeus package around the GraphQL schema, and visit localhost:3030/nuqleus to access the nuQLeus GUI. For a more detailed installation procedure, refer to the read-me on nuQLeus’ GitHub (linked at the bottom of the page). The dev tool is currently available for both express-graphql and apollo-server implementations, with the goal for future versions to support more GraphQL server implementations in Node.js.

Alt Text

Target Audience

nuQLeus is built for API developers configuring or migrating to GraphQL architecture who need to test and gauge query and mutation performance. It is a quick and easy way to measure response times for each data field queried or mutated. nuQLeus is also a great tool for code hobbyists curious to learn more about GraphQL performance and efficiencies.

The Future

Currently, nuQLeus is in beta, with much to add! Primary stretch goals include the following:

  • Include support for additional graphql engine implementations like graphql-yoga, and graphql-helix

  • Add tracing support for graphql subscriptions

  • Include additional visualizations of relevant information users may find helpful

  • Set up a history storage system for user inputs and results
    Allow comparisons between past and present queries and mutations

For anyone interested, please check out the Github and send a PR! We look forward to your comments and feedback!

Authors
Daniel Perez | linkedin.com/in/Daniel-P3 | Daniel-P3
Jenny Hai | linkedin.com/in/jenny-hai | jhai420
Joshua Kim | linkedin.com/in/joshjkim | jkim000
Zach Brucker | linkedin.com/in/zach-brucker | zbrucker

Discussion (0)