hasura / graphql-bench

A super simple tool to benchmark GraphQL queries
Apache License 2.0
265 stars 41 forks source link

Unable to benchmark our own GraphQL server for Doublets #52

Open Konard opened 3 years ago

Konard commented 3 years ago

We are trying to benchmark our GraphQL server implementation for Doublets (database engine based on associative model of data).

This the YAML file we tried:

url: 'http://linksplatform.ddns.net:29018/graphql'
queries:
  - name: GetSingleLink
    tools: [k6, wrk2, autocannon]
    execution_strategy: REQUESTS_PER_SECOND
    rps: 1
    duration: 1s
    query: '{ links(where: {from_id: {_eq: 2}, to_id: {_eq: 1}}) { id from_id to_id } }'
  - name: UseFromIndex
    tools: [k6, wrk2, autocannon]
    execution_strategy: REQUESTS_PER_SECOND
    rps: 1
    duration: 1s
    query: '{ links(where: {from_id: {_eq: 1}}) { id } }'
  - name: UseToIndex
    tools: [k6, wrk2, autocannon]
    execution_strategy: REQUESTS_PER_SECOND
    rps: 1
    duration: 1s
    query: '{ links(where: {to_id: {_eq: 1}}) { id } }'
  - name: FullScan
    tools: [k6, wrk2, autocannon]
    execution_strategy: REQUESTS_PER_SECOND
    rps: 1
    duration: 1s
    query: '{ links { id } }'

But all requests are ended up with 400 or 500 codes. And I'm not able to see exact error in the benchmark tool. Is there a way to see how the request is sent and what response is received via the benchmark tool?

If I use any other client (via UI, insomnia or plain JavaScript ApolloClient from the node.js) I do not get any errors with these requests. Only graphql-bench is unable to make request for some reason.

GavinRay97 commented 3 years ago

Heya, you should be able to add a property to each query, debug: true, and see in the process output what is happening (this is not supported for wrk2 atm, only k6 and autocannon):

https://github.com/hasura/graphql-bench/blob/0098bef8f2a9d31fffd10f2d75288ee5c4dcc3d2/app/queries/src/executors/autocannon/index.ts#L108-L110

https://github.com/hasura/graphql-bench/blob/0098bef8f2a9d31fffd10f2d75288ee5c4dcc3d2/app/queries/src/executors/k6/index.ts#L178-L179

So it would look like:

url: 'http://linksplatform.ddns.net:29018/graphql'
queries:
  - name: GetSingleLink
    debug: true
    tools: [k6, autocannon]
    execution_strategy: REQUESTS_PER_SECOND
    rps: 100
    duration: 10s
    query: |
      query {
        links(where: {
          from_id: { _eq: 2 },
          to_id: { _eq: 1 }
        }) {
          id
          from_id
          to_id
        }
      }

Maybe you need Content-Type: application/json in headers?

url: 'http://linksplatform.ddns.net:29018/graphql'
headers:
    Content-Type: "application/json"
queries:
  - name: GetSingleLink
    # ...