99designs / 99designs/gqlgen

No restriction on firing goroutines.

未关闭
#2,704 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
10.8k
派生
1.3k
平均合并
2 天 36 分钟
30 天内合并 PR
26

描述

### What happened?
On load testing my server with 2000 requests , i generted a pprof trace and turns out over 6,00,000 goroutines were fired during the span. The request endpoint was pretty simple and CPU bound, on firing so many goroutines, they are competing for resource and most of time is getting spend on context switching.
### What did you expect?
There should be a finite version gorountes via worker pool
![Screenshot 2023-07-03 at 10 09 04](https://github.com/99designs/gqlgen/assets/42290488/38b21088-3353-459d-a367-9c9229bbf3e4)

### Minimal graphql.schema and models to reproduce
an array of type Content {
k: String!
v: String!
}

type ExternalReference {
id: Int!
source: String!
}

### versions
- `go run github.com/99designs/gqlgen version`?
- github.com/99designs/gqlgen v0.17.20
- `go version`? go1.19.3
-

贡献指南

打开贡献指南

调研方向

该 issue 提到一个 pprof trace,显示在负载下创建了过多的 goroutine。首先检查 gqlgen codebase 中创建 goroutine 的模式,尤其是 request 处理或 resolver 执行部分。查找现有的并发控制或 worker pool。使用一个简单的 GraphQL schema 重现负载测试,以分析 goroutine 数量。确定应在何处引入 goroutine 限制或 worker pool 机制。

由索引模型根据 Issue 内容生成。

评估

技术栈
go
领域
performance
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。