Git Product home page Git Product logo

graphql-bench's Introduction

graphql-bench

A simple benchmarking tool to run GraphQL queries against your GraphQL backend and get a preliminary sense of its performance characteristics.

Usage: You write your GrahphQL queries in a file, run a command, and your browser opens up with graphs :)

comparison example

Running benchmarks

You'll need docker installed on your machine. All the tooling necessary to run and visualise benchmarks is packaged in a docker image.

  1. Create a file, say queries.graphql with the queries that you are interested in benchmarking.

    query HeroNameQuery {
      hero {
        name
      }
    }
  2. Specify the benchmarking configuration in a file, say bench.yaml.

    - name: hero_name
      warmup_duration: 60
      duration: 300
      candidates:
      - name: python-graphene
        url: http://127.0.0.1:5000
        query: HeroNameQuery
        queries_file: queries.graphql
      rps:
      - 200
      - 400
  3. Run the benchmark(s).

    cat bench.yaml | docker run -i --rm -p 8050:8050 -v $(pwd)/queries.graphql:/graphql-bench/ws/queries.graphql hasura/graphql-bench:v0.3
  4. This opens up a http server at http://127.0.0.1:8050 which displays the results of the benchmark. graph example

bench.yaml

This file specifes the benchmarks that need to be run. The file is a list of benchmark specifications as follows:

  # name of the benchmark.
- name: tracks_media_some

  # response timeout
  timeout: 1s

  # the benchmarks are first run for this duration and the results are ignored
  warmup_duration: 60

  # the duration of each benchmark
  duration: 300

  # number of open connections to the server
  open_connections: 20

  # the servers to be benchmarked, their dir and urls
  candidates:
  - name: myserver
    url: http://172.17.0.1:7080
    query: abc
    queries_file: queries.graphql

  # Requests/sec
  rps:
  - 200
  - 400

Note

If you are looking for benchmarks of hasura, postgraphile and prisma head to this repo.

graphql-bench's People

Contributors

coco98 avatar

Watchers

Rajoshi Ghosh 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.