-
Notifications
You must be signed in to change notification settings - Fork 25
[WIP] Benchmark Tests #686
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.basic.BasicObjectSchemaTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class BasicObjectSchemaBenchmark: BenchmarkTestBase() { | ||
|
|
||
| @Setup | ||
| override fun setup() { | ||
| test = BasicObjectSchemaTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.batchHydration.BatchHydrationAtQueryTypeTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class BatchHydrationAtQueryTypeBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = BatchHydrationAtQueryTypeTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.hydration.defer.batch.BatchHydrationDeferTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class BatchHydrationDeferBenchmark: BenchmarkTestBase() { | ||
|
|
||
| @Setup | ||
| override fun setup() { | ||
| test = BatchHydrationDeferTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.Nadel | ||
| import graphql.nadel.NadelExecutionInput | ||
| import graphql.nadel.tests.next.NadelIntegrationTest | ||
| import org.openjdk.jmh.annotations.Fork | ||
| import org.openjdk.jmh.annotations.Measurement | ||
| import org.openjdk.jmh.annotations.Scope | ||
| import org.openjdk.jmh.annotations.State | ||
| import org.openjdk.jmh.annotations.Warmup | ||
|
|
||
| @State(Scope.Benchmark) | ||
| @Warmup(iterations = 5, time = 5) | ||
| @Measurement(iterations = 5) | ||
| @Fork(2) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a blocker for this PR: For GraphQL Java benchmarks we had slightly fewer warmup and measurement runs. Usually 2 for warmup and 2-3 for measurement Because the GraphQL Java benchmark tests run on every commit we had to be more careful there about the total running time for the tests (we arbitrarily set a limit of about 1 hour). |
||
| open class BenchmarkTestBase { | ||
|
|
||
| lateinit var test: NadelIntegrationTest | ||
| private lateinit var nadel: Nadel | ||
| private lateinit var executionInput: NadelExecutionInput | ||
|
|
||
| open fun setup() { | ||
| executionInput = test.makeExecutionInput().build() | ||
| } | ||
|
|
||
| fun execute() { | ||
| nadel = test.makeNadel() | ||
| .build() | ||
| nadel.execute(executionInput).get() | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.defer.ComprehensiveDeferQueryWithDifferentServiceCalls | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class ComprehensiveDeferQueryWithDifferentServiceCallsBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = ComprehensiveDeferQueryWithDifferentServiceCalls() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: this is a typo, should be |
||
| execute() | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.basic.BasicObjectSchemaTest | ||
| import graphql.nadel.tests.next.fixtures.basic.EchoTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class EchoBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = EchoTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.hydration.idHydration.IdHydrationTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class IdHydrationBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = IdHydrationTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.defer.MultipleDeferWithDifferentServiceCalls | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class MultipleDeferWithDifferentServiceCallsBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = MultipleDeferWithDifferentServiceCalls() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.defer.MultipleFieldsInMultipleDeferDirectivesTest | ||
| import graphql.nadel.tests.next.fixtures.defer.transforms.MultipleRenamedFieldsAreDeferredTogether | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class MultipleFieldsInMultipleDeferDirectivesBenchmark: BenchmarkTestBase() { | ||
|
|
||
| @Setup | ||
| override fun setup() { | ||
| test = MultipleFieldsInMultipleDeferDirectivesTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.defer.transforms.MultipleRenamedFieldsAreDeferredTogether | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class MultipleRenamedFieldsAreDeferredTogetherBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = MultipleRenamedFieldsAreDeferredTogether() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.partition.NamespacedPartitionTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class NamespacedPartitionBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = NamespacedPartitionTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.defer.NestedDefersTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class NestedDefersBenchmark: BenchmarkTestBase() { | ||
| @Setup | ||
| override fun setup() { | ||
| test = NestedDefersTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package performance | ||
|
|
||
| import graphql.nadel.tests.next.fixtures.partition.NestedPartitionTest | ||
| import org.openjdk.jmh.annotations.Benchmark | ||
| import org.openjdk.jmh.annotations.BenchmarkMode | ||
| import org.openjdk.jmh.annotations.Mode | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit | ||
| import org.openjdk.jmh.annotations.Setup | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| open class NestedPartitionBenchmark: BenchmarkTestBase() { | ||
|
|
||
| @Setup | ||
| override fun setup() { | ||
| test = NestedPartitionTest() | ||
| super.setup() | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| fun bechmarkThroughput() { | ||
| execute() | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you can remove
WIPfrom the PR name, to indicate you're ready for a review