{"id":13514210,"url":"https://github.com/appleboy/golang-graphql-benchmark","last_synced_at":"2025-04-13T18:33:57.445Z","repository":{"id":56699816,"uuid":"137641689","full_name":"appleboy/golang-graphql-benchmark","owner":"appleboy","description":"benchmark of golang GraphQL framework.","archived":false,"fork":false,"pushed_at":"2023-08-06T13:01:55.000Z","size":7980,"stargazers_count":130,"open_issues_count":6,"forks_count":12,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-21T07:34:59.823Z","etag":null,"topics":["benchmark","golang","graphql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appleboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-17T09:03:23.000Z","updated_at":"2024-05-03T14:44:57.000Z","dependencies_parsed_at":"2023-09-26T04:41:25.105Z","dependency_job_id":null,"html_url":"https://github.com/appleboy/golang-graphql-benchmark","commit_stats":{"total_commits":71,"total_committers":3,"mean_commits":"23.666666666666668","dds":"0.028169014084507005","last_synced_commit":"9c38a977d32979c699e9a83886c6c851e684e7c3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgolang-graphql-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgolang-graphql-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgolang-graphql-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgolang-graphql-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appleboy","download_url":"https://codeload.github.com/appleboy/golang-graphql-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247412690,"owners_count":20934891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","golang","graphql"],"created_at":"2024-08-01T05:00:49.700Z","updated_at":"2025-04-13T18:33:57.422Z","avatar_url":"https://github.com/appleboy.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# golang-graphql-benchmark\n\n[![Build Status](https://cloud.drone.io/api/badges/appleboy/golang-graphql-benchmark/status.svg)](https://cloud.drone.io/appleboy/golang-graphql-benchmark)\n\nbenchmark of graphql framework in [go1.15](https://golang.org/doc/go1.15) version.\n\n* [graphql-go/graphql](https://github.com/graphql-go/graphql) version: v0.7.9\n* [playlyfe/go-graphql](https://github.com/playlyfe/go-graphql) version: v0.0.0-20191219091308-23c3f22218ef\n* [graph-gophers/graphql-go](https://github.com/graph-gophers/graphql-go) version: v0.0.0-20200622220639-c1d9693c95a6\n* [samsarahq/thunder](https://github.com/samsarahq/thunder) version: v0.5.0\n* [99designs/gqlgen](https://github.com/99designs/gqlgen) version: v0.13.0\n\n## Benchmark Result (2020/09/26)\n\nPlease execute the following command.\n\n```sh\ngit clone https://github.com/appleboy/golang-graphql-benchmark.git\ncd golang-graphql-benchmark\ngo test -v -bench=Master -benchmem\n```\n\nResult:\n\n```sh\ngoos: linux\ngoarch: amd64\npkg: github.com/appleboy/golang-graphql-benchmark\nBenchmarkGoGraphQLMaster-48                 12556         95348 ns/op       27433 B/op         444 allocs/op\nBenchmarkPlaylyfeGraphQLMaster-48          123614         10340 ns/op        2857 B/op          56 allocs/op\nBenchmarkGophersGraphQLMaster-48           165276          7354 ns/op        3683 B/op          38 allocs/op\nBenchmarkThunderGraphQLMaster-48           324900          3755 ns/op        1336 B/op          30 allocs/op\n```\n\nTesting with http framwork using [Gin](https://github.com/gin-gonic/gin)\n\n```sh\ngo test -v -bench=Route -benchmem\n```\n\nResult:\n\n```sh\ngoos: linux\ngoarch: amd64\npkg: github.com/appleboy/golang-graphql-benchmark\nBenchmarkGinHttpRoute-48                    397496          2790 ns/op        1262 B/op          18 allocs/op\nBenchmarkGinGQLGenRoute-48                  383760          3034 ns/op         986 B/op          13 allocs/op\nBenchmarkGinGoGraphQLRoute-48                29984         38296 ns/op       17489 B/op         226 allocs/op\nBenchmarkGinGopherGraphQLRoute-48           952279          1189 ns/op         972 B/op           6 allocs/op\nBenchmarkGinThunderGraphQLRoute-48          571414          1840 ns/op        1193 B/op          11 allocs/op\n```\n\n## Benchmark from wrk benchmarking tool\n\n[wrk](https://github.com/wg/wrk) - a HTTP benchmarking tool\n\n### [gin + graphql-go](golang/graphql-go)\n\n```sh\n$ wrk -t12 -c400 -d30s --timeout 10s --script=golang/post.lua --latency http://localhost:8080/graphql\nRunning 30s test @ http://localhost:8080/graphql\n  12 threads and 400 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency    78.26ms  114.59ms   1.31s    86.37%\n    Req/Sec     1.59k   537.11     4.15k    68.81%\n  Latency Distribution\n     50%    7.68ms\n     75%  128.89ms\n     90%  221.97ms\n     99%  499.33ms\n  571048 requests in 30.05s, 81.14MB read\n  Socket errors: connect 0, read 233, write 0, timeout 0\nRequests/sec:  19004.92\nTransfer/sec:      2.70MB\n```\n\n### [gin + graph-gophers](golang/graph-gophers)\n\n```sh\n$ wrk -t12 -c400 -d30s --timeout 10s --script=golang/post.lua --latency http://localhost:8080/graphql\nRunning 30s test @ http://localhost:8080/graphql\n  12 threads and 400 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency    10.75ms   10.75ms 214.71ms   88.06%\n    Req/Sec     3.71k   583.50     6.30k    72.11%\n  Latency Distribution\n     50%    7.21ms\n     75%   12.15ms\n     90%   23.80ms\n     99%   53.21ms\n  1331529 requests in 30.05s, 170.16MB read\n  Socket errors: connect 0, read 236, write 0, timeout 0\nRequests/sec:  44308.44\nTransfer/sec:      5.66MB\n```\n\n### [gin + thunder](golang/thunder)\n\n```sh\n$ wrk -t12 -c400 -d30s --timeout 10s --script=golang/post.lua --latency http://localhost:8080/graphql\nRunning 30s test @ http://localhost:8080/graphql\n  12 threads and 400 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency    12.34ms   13.20ms 181.22ms   85.99%\n    Req/Sec     3.43k   540.37     5.90k    72.64%\n  Latency Distribution\n     50%    8.09ms\n     75%   17.52ms\n     90%   30.13ms\n     99%   58.72ms\n  1232462 requests in 30.06s, 224.50MB read\n  Socket errors: connect 0, read 232, write 0, timeout 0\nRequests/sec:  40994.33\nTransfer/sec:      7.47MB\n```\n\n### [gin + gqlgen](golang/gqlgen/gin-server)\n\n```sh\n$ wrk -t12 -c400 -d30s --timeout 10s --script=golang/post.lua --latency http://localhost:8080/graphql\nRunning 30s test @ http://localhost:8080/graphql\n  12 threads and 400 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency     7.77ms    2.61ms  66.76ms   82.63%\n    Req/Sec     4.18k   474.51     9.97k    83.78%\n  Latency Distribution\n     50%    7.48ms\n     75%    8.47ms\n     90%    9.99ms\n     99%   18.09ms\n  1501098 requests in 30.07s, 191.83MB read\n  Socket errors: connect 0, read 239, write 0, timeout 0\nRequests/sec:  49925.73\nTransfer/sec:      6.38MB\n```\n\n### [net/http + gqlgen](golang/gqlgen/httpd-server)\n\n```sh\n$ wrk -t12 -c400 -d30s --timeout 10s --latency http://localhost:8080/graphql?query={hello}\nRunning 30s test @ http://localhost:8080/graphql?query={hello}\n  12 threads and 400 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency     7.61ms    4.44ms 143.61ms   97.03%\n    Req/Sec     4.43k   491.36     6.86k    80.94%\n  Latency Distribution\n     50%    7.24ms\n     75%    8.04ms\n     90%    8.99ms\n     99%   18.35ms\n  1588061 requests in 30.05s, 216.57MB read\n  Socket errors: connect 0, read 255, write 0, timeout 0\nRequests/sec:  52854.88\nTransfer/sec:      7.21MB\n```\n\n### [gin + josn](golang/gin-json)\n\n```sh\n$ wrk -t12 -c400 -d30s --timeout 10s --script=golang/json.lua --latency http://localhost:8080/graphql\nRunning 30s test @ http://localhost:8080/graphql\n  12 threads and 400 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency     7.05ms    1.94ms  40.57ms   81.71%\n    Req/Sec     4.64k   415.61     7.95k    85.89%\n  Latency Distribution\n     50%    6.89ms\n     75%    7.66ms\n     90%    8.79ms\n     99%   14.50ms\n  1663093 requests in 30.06s, 356.86MB read\n  Socket errors: connect 0, read 236, write 0, timeout 0\n  Non-2xx or 3xx responses: 1663093\nRequests/sec:  55334.07\nTransfer/sec:     11.87MB\n```\n\n## Summary\n\n|                   | Requests/sec |\n| ----------------- | ------------ |\n| graphql-go        | 19004.92     |\n| graph-gophers     | 44308.44     |\n| thunder           | 40994.33     |\n| gqlgen + gin      | 49925.73     |\n| gqlgen + net/http | **52854.88** |\n\nWithout graphql (only gin render json output)\n\n|                      | Requests/sec  |\n| -------------------- | ------------- |\n| json without graphql | **55334.07** |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fgolang-graphql-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappleboy%2Fgolang-graphql-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fgolang-graphql-benchmark/lists"}