Skip to content

Research: Hackday #3 Performance Research #322

Closed
@colinmurphy

Description

@colinmurphy

Overview

While we try and define what we are doing for #152 I am going to use this Hack day to explore some possibilities around getting visibility for performance.

High Level

  1. Develop a WPGraphQL Plugin Extension that does the following:
  • Tracks key metrics for performance (e.g. response time) by hooking into various events in the WPGraphQL lifecycle
  • Retrieve the query for analysis
  • Setup a rule based system to analyze the query and metrics and give some reccoemndations
  • Add an extension to the response with these reccomendations
  1. Then on the frontend output this analysis (maybe in the console)

This is a POC so going to focus in on:

  1. Building a MVP plugin which tracks the query and checks if a rule of "less than 50 posts" are retrieved.
  2. Sends back a response to the frontend e.g.
{
  "data": { ... },
  "extensions": {
    "performance": {
      "queryTime": "6.05s",
      "dbQueries": 47,
      "memoryUsage": "125MB",
      "recommendations": [
        {
          "type": "pagination",
          "message": "You should really be paginating those queries",
          "link": "https://docs.wpgraphql.com/pagination"
        }
      ]
    }
  }
}

Nice to haves

  1. Rule system setup (even if we only have one rule)
  2. Add events (actions and filters) as POC to show how you could extend this
  3. A very nice to have is have some AI analysis but probably won't have time.

Outcome

To help determine how feasible it is to do performance analysis for headless WordPress and help determine outcomes for our Q3 Goal of Performance Data in Headless WordPress Applications(https://github.com/wpengine/hwptoolkit/discussions/152) - Help developers identify key performance issues by supplying relevant documentation (such as best practices, debug help guides) and tools to analyze the performance of their headless application.

Tasks

  • Setup plugin

  • Setup frontend application

  • Send data back in the response

  • Parse data on the frontend

  • Review WPGraphQL Lifecycle

  • Analyse WPGraphQL query

  • Setup rule based system

  • Add a rule for length of the query

  • Add a rule for pagination

Metadata

Metadata

Labels

type:researchCovers research and explorational tasks

Type

No type

Projects

Status

✅ Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions