GithubHelp home page GithubHelp logo

graphql-engine-profiling-demo's Introduction

graphql-engine Profiling Demo

NOTE: This repository contains important submodules. Either clone with the --recursive flag or do git submodule init && git submodule update after cloning.


A demo of profiling Hasura's graphql-engine using ghc-eventlog-socket and eventlog-live. Components:

  • A graphql-engine executable that has been instrumented using ghc-eventlog-socket to stream its eventlog over a socket during execution.
  • Another executable (in eventlog-influxdb) which reads data from the eventlog socket and inserts it into an InfluxDB database.
  • A benchmarking tool (in ./bench) copied from the existing graphql-engine benchmark suite to generate traffic and make the profile more interesting.
  • A Grafana instance to view the live eventlog data on a pretty webpage.
  • A Docker Compose configuration to tie all of this together and run it all with a single command.

Usage

Build the images

NOTE: There are linux/amd64 and linux/arm64 images published on Docker Hub which are already listed in the docker-compose.yml, but they may be out of date or otherwise unacceptable, hence these instructions. Skip to Start the containers to use the prebuilt images.

Begin by building the base benchmarking image:

docker build ./bench/graphql-bench/app -t finleymcilwaine/graphql-bench:base

Then build the benchmarking image:

docker build ./bench -t finleymcilwaine/graphql-bench:main

Now build the base graphql-engine image:

docker build ./engine -f ./engine/base.Dockerfile -t finleymcilwaine/graphql-engine:base

Then build the graphql-engine image:

docker build ./engine -f ./engine/main.Dockerfile -t finleymcilwaine/graphql-engine:main

With the images built, the steps below should now work for you.

Start the containers

Run everything with just:

docker compose up

If it's your first time pulling the images, it may take a while (the graphql-engine image is about 1GB in compressed size).

The benchmark will just run on a loop. There will be a lot of docker compose log output from the the PostgreSQL and graphql-engine instances as they handle the requests from the benchmark.

Viewing the data

With Grafana

Navigate to localhost:3000 for the Grafana instance. Enter username admin and password admin.

The dashboards from ./grafana/dashboards are automatically loaded into the instance. To view and interact with them, select the "Dashboards" tab:

Query InfluxDB

To check the data in the InfluxDB instance directly, you can submit queries from your local command-line, e.g.:

curl -G 'localhost:8086/query?pretty=true&u=admin&p=admin' --data-urlencode "db=eventlog" --data-urlencode "q=SHOW MEASUREMENTS ON eventlog"

Outputs the available measurements.

curl -G 'localhost:8086/query?pretty=true&u=admin&p=admin' --data-urlencode "db=eventlog" --data-urlencode "q=SELECT * FROM \"gauge.eventlog.heap_size\""

Outputs the heap size measurement data.

graphql-engine-profiling-demo's People

Contributors

finleymcilwaine avatar mpickering avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.