Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit d5e8c9b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into k6_migration
2 parents 8ae138b + f7d4d66 commit d5e8c9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2121
-301
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt-get update && apt-get install -y \
1818
&& rm -rf /var/lib/apt/lists/*
1919

2020
# Install the latest LTS version of Node.js
21-
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
21+
RUN curl -L https://deb.nodesource.com/nsolid_setup_deb.sh | bash -s -- 18 && \
2222
apt-get install -y nodejs
2323

2424
# Install Go

README.md

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ Explore and compare the performance of the fastest GraphQL frameworks through ou
1717
- [GraphQL Schema](#graphql-schema)
1818
- [Contribute](#contribute)
1919

20-
[Tailcall]: https://tailcall.run/
21-
[Gqlgen]: https://gqlgen.com/
22-
[Apollo GraphQL]: https://new.apollographql.com/
23-
[Netflix DGS]: https://netflix.github.io/dgs/
24-
[Caliban]: https://ghostdogpr.github.io/caliban/
20+
[Tailcall]: https://github.com/tailcallhq/tailcall
21+
[Gqlgen]: https://github.com/99designs/gqlgen
22+
[Apollo GraphQL]: https://github.com/apollographql/apollo-server
23+
[Netflix DGS]: https://github.com/netflix/dgs-framework
24+
[Caliban]: https://github.com/ghostdogpr/caliban
2525
[async-graphql]: https://github.com/async-graphql/async-graphql
26+
[Hasura]: https://github.com/hasura/graphql-engine
27+
[GraphQL JIT]: https://github.com/zalando-incubator/graphql-jit
2628

2729
## Introduction
2830

@@ -49,21 +51,32 @@ Get started with the benchmarks:
4951
| Query | Server | Requests/sec | Latency (ms) | Relative |
5052
|-------:|--------:|--------------:|--------------:|---------:|
5153
| 1 | `{ posts { id userId title user { id name email }}}` |
52-
|| [Tailcall] | `29,534.90` | `3.37` | `102.64x` |
53-
|| [Hasura] | `4,601.66` | `21.71` | `15.99x` |
54-
|| [Caliban] | `1,574.63` | `63.42` | `5.47x` |
55-
|| [async-graphql] | `1,457.27` | `68.51` | `5.06x` |
56-
|| [Gqlgen] | `641.88` | `156.54` | `2.23x` |
57-
|| [Netflix DGS] | `362.21` | `150.25` | `1.26x` |
58-
|| [Apollo GraphQL] | `287.75` | `345.31` | `1.00x` |
54+
|| [Tailcall] | `30,004.80` | `3.32` | `111.96x` |
55+
|| [async-graphql] | `1,862.55` | `53.71` | `6.95x` |
56+
|| [Caliban] | `1,535.48` | `65.27` | `5.73x` |
57+
|| [Hasura] | `1,474.01` | `67.57` | `5.50x` |
58+
|| [GraphQL JIT] | `1,325.51` | `75.13` | `4.95x` |
59+
|| [Gqlgen] | `763.01` | `130.02` | `2.85x` |
60+
|| [Netflix DGS] | `362.91` | `160.04` | `1.35x` |
61+
|| [Apollo GraphQL] | `268.00` | `367.08` | `1.00x` |
5962
| 2 | `{ posts { title }}` |
60-
|| [Tailcall] | `61,457.60` | `1.62` | `38.92x` |
61-
|| [Caliban] | `9,243.21` | `11.19` | `5.85x` |
62-
|| [async-graphql] | `7,321.85` | `13.66` | `4.64x` |
63-
|| [Hasura] | `5,648.75` | `17.70` | `3.58x` |
64-
|| [Gqlgen] | `2,196.22` | `46.47` | `1.39x` |
65-
|| [Apollo GraphQL] | `1,735.65` | `57.40` | `1.10x` |
66-
|| [Netflix DGS] | `1,579.14` | `69.21` | `1.00x` |
63+
|| [Tailcall] | `61,811.50` | `1.61` | `44.69x` |
64+
|| [async-graphql] | `9,412.32` | `10.76` | `6.81x` |
65+
|| [Caliban] | `9,057.38` | `11.39` | `6.55x` |
66+
|| [Hasura] | `2,437.90` | `40.99` | `1.76x` |
67+
|| [Gqlgen] | `2,176.64` | `47.66` | `1.57x` |
68+
|| [Apollo GraphQL] | `1,750.92` | `57.02` | `1.27x` |
69+
|| [Netflix DGS] | `1,598.51` | `69.51` | `1.16x` |
70+
|| [GraphQL JIT] | `1,383.03` | `72.19` | `1.00x` |
71+
| 3 | `{ greet }` |
72+
|| [Caliban] | `68,200.20` | `1.07` | `26.86x` |
73+
|| [Tailcall] | `63,728.50` | `1.58` | `25.10x` |
74+
|| [async-graphql] | `51,025.70` | `1.98` | `20.09x` |
75+
|| [Gqlgen] | `47,338.30` | `5.10` | `18.64x` |
76+
|| [Netflix DGS] | `8,138.82` | `15.05` | `3.20x` |
77+
|| [Apollo GraphQL] | `7,989.19` | `12.73` | `3.15x` |
78+
|| [GraphQL JIT] | `5,136.79` | `19.44` | `2.02x` |
79+
|| [Hasura] | `2,539.46` | `39.31` | `1.00x` |
6780

6881
<!-- PERFORMANCE_RESULTS_END -->
6982

@@ -87,6 +100,15 @@ Get started with the benchmarks:
87100

88101
![Latency Histogram](assets/latency_histogram2.png)
89102

103+
### 3. `{greet}`
104+
#### Throughput (Higher is better)
105+
106+
![Throughput Histogram](assets/req_sec_histogram3.png)
107+
108+
#### Latency (Lower is better)
109+
110+
![Latency Histogram](assets/latency_histogram3.png)
111+
90112
## Architecture
91113

92114
![Architecture Diagram](assets/architecture.png)

analyze.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ formattedServerNames=(
1919
["caliban"]="Caliban"
2020
["async_graphql"]="async-graphql"
2121
["hasura"]="Hasura"
22+
["graphql_jit"]="GraphQL JIT"
2223
)
2324

24-
servers=("apollo" "caliban" "netflixdgs" "gqlgen" "tailcall" "async_graphql" "hasura")
25+
servers=("apollo" "caliban" "netflixdgs" "gqlgen" "tailcall" "async_graphql" "hasura" "graphql_jit")
2526
resultFiles=("$@")
2627
declare -A avgReqSecs
2728
declare -A avgLatencies
@@ -56,7 +57,9 @@ done
5657

5758
whichBench=1
5859
if [[ $1 == bench2* ]]; then
59-
whichBench=2
60+
whichBench=2
61+
elif [[ $1 == bench3* ]]; then
62+
whichBench=3
6063
fi
6164

6265
reqSecHistogramFile="req_sec_histogram${whichBench}.png"
@@ -107,8 +110,10 @@ lastServerReqSecs=${avgReqSecs[$lastServer]}
107110
# Start building the resultsTable
108111
if [[ $whichBench == 1 ]]; then
109112
resultsTable="<!-- PERFORMANCE_RESULTS_START -->\n\n| Query | Server | Requests/sec | Latency (ms) | Relative |\n|-------:|--------:|--------------:|--------------:|---------:|\n| $whichBench | \`{ posts { id userId title user { id name email }}}\` |"
110-
else
113+
elif [[ $whichBench == 2 ]]; then
111114
resultsTable="| $whichBench | \`{ posts { title }}\` |"
115+
elif [[ $whichBench == 3 ]]; then
116+
resultsTable="| $whichBench | \`{ greet }\` |"
112117
fi
113118

114119
# Build the resultsTable with sorted servers and formatted numbers
@@ -121,7 +126,7 @@ for server in "${sortedServers[@]}"; do
121126
resultsTable+="\n|| [${formattedServerNames[$server]}] | \`${formattedReqSecs}\` | \`${formattedLatencies}\` | \`${relativePerformance}x\` |"
122127
done
123128

124-
if [[ $whichBench == 2 ]]; then
129+
if [[ $whichBench == 3 ]]; then
125130
resultsTable+="\n\n<!-- PERFORMANCE_RESULTS_END -->"
126131
fi
127132

@@ -132,7 +137,7 @@ resultsFile="results.md"
132137
echo -e $resultsTable >> $resultsFile
133138

134139

135-
if [[ $whichBench == 2 ]]; then
140+
if [[ $whichBench == 3 ]]; then
136141
finalResults=$(printf '%s\n' "$(cat $resultsFile)" | sed 's/$/\\n/'| tr -d '\n')
137142
# Remove the last newline character
138143
finalResults=${finalResults::-2}

assets/latency_histogram1.png

1.11 KB
Loading

assets/latency_histogram2.png

1.13 KB
Loading

assets/latency_histogram3.png

23.4 KB
Loading

assets/req_sec_histogram1.png

1.22 KB
Loading

assets/req_sec_histogram2.png

1.07 KB
Loading

assets/req_sec_histogram3.png

23.9 KB
Loading

graphql/apollo_server/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const typeDefs = `#graphql
3131
3232
type Query {
3333
posts: [Post]
34+
greet: String!
3435
}
3536
`;
3637

@@ -44,7 +45,7 @@ async function batchUsers(usersIds) {
4445
host: "127.0.0.1",
4546
port: 3000,
4647
},
47-
}
48+
},
4849
);
4950
return response.data;
5051
});
@@ -70,6 +71,9 @@ const resolvers = {
7071
throw new Error("Failed to fetch posts");
7172
}
7273
},
74+
greet: () => {
75+
return "Hello World!";
76+
},
7377
},
7478
Post: {
7579
user: async (post, _, { userLoader }) => {
@@ -87,8 +91,8 @@ const { url } = await startStandaloneServer(server, {
8791
context: async () => {
8892
return {
8993
userLoader: new DataLoader(batchUsers, {
90-
batchScheduleFn: callback => setTimeout(callback, 1),
91-
})
94+
batchScheduleFn: (callback) => setTimeout(callback, 1),
95+
}),
9296
};
9397
},
9498
listen: { port: 8000 },

0 commit comments

Comments
 (0)