Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example stress query #583

Merged
merged 5 commits into from Feb 3, 2020
Merged

Conversation

smyrick
Copy link
Contributor

@smyrick smyrick commented Jan 30, 2020

馃摑 Description

Add a StressQuery that will create a lot of nodes so we can stress test data fetchers with a single query instead of lots of requests.

This will help us debug performance overhead around PropertyDataFetcher vs FunctionDataFetcher vs suspend FunctionDataFetcher

Test Results

I used YourKit locally to get a snapshot of each query. The files are too big to upload but I am looking at the results right now

Property

query stress {
  stressNode(count:100000) {
    valueId
  }
}

Functions

query stress {
  stressNode(count:100000) {
    functionId
  }
}

Suspend Functions

query stress {
  stressNode(count:100000) {
    suspendId
  }
}

@smyrick smyrick added the type: documentation Documentation or test changes label Jan 30, 2020
@smyrick smyrick changed the title Stress query Add example stress query Jan 30, 2020
@smyrick
Copy link
Contributor Author

smyrick commented Jan 30, 2020

I looked at all the snapshots for the time to execute SimpleQueryHandler::executeQuery since this is run for each request and ignores all the started up time and the serialization/server time.

Here are the times in ms

valueId functionId suspendId
2681 2781 3400
0% +4% valueId +27% valueId, +22% functionId

The difference between a FunctionDataFetcher and PropertyDataFetcher does exist but it is not the major concern. There is significant overhead to run suspending functions when we create a lot of them though from the baseline of a just returning properties.

@smyrick
Copy link
Contributor Author

smyrick commented Jan 30, 2020

Instrumentation

I added two more queries which add the TrackTimesInvokedInstrumentation. This track the total number of times each field that is marked with the directive is invoked for every request. This just simulates some instrumentation that would perform some work and modify a state object per field.

Running a query like this logs the following on the server TrackTimesInvokedInstrumentation fields invoked: {loggingFunctionId=10, suspendLoggingFunctionId=10}

query stress {
  stressNode(count:10) {
    valueId
    loggingFunctionId
    suspendLoggingFunctionId
  }
}

Queries

Function Instrumentation

query stress {
  stressNode(count:100000) {
    suspendLoggingFunctionId
  }
}

Suspend Function Instrumentation

query stress {
  stressNode(count:100000) {
    loggingFunctionId
  }
}

Performance

loggingFunctionId suspendLoggingFunctionId
3726 3983
0% +7%

@smyrick smyrick merged commit cb7ba81 into ExpediaGroup:master Feb 3, 2020
@smyrick smyrick deleted the stress-query branch February 3, 2020 22:00
dariuszkuc pushed a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
* Add stress query

* Update stress query to simplify structure

* Add instrumentation stress queries

* Update log statement

* Move instrumentation state to private class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation Documentation or test changes
Development

Successfully merging this pull request may close these issues.

None yet

1 participant