Self-hosted: Postgres JIT makes the environment lookup take ~3 s, so SDK events time out
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
调研方向
Start by finding the environment-by-key lookup that combines the Environment and EnvironmentAPIKey queries, then inspect the self-hosting Docker Compose configuration. Compare the reported query with JIT enabled and disabled to confirm the cause. Done means avoiding the reported multi-second lookup for self-hosted PostgreSQL users without changing lookup behavior.
由索引模型根据 Issue 内容生成。
描述
Setup: the docker-compose from the self-hosting docs, Flagsmith 2.295.2, postgres:15.5-alpine (JIT on, the Postgres default), Experimentation enabled.
What happens: about one SDK request in five took just over 3 seconds (/api/v1/flags/, /api/v1/events; /health/liveness/ was always fast). With log_min_duration_statement on, the slow statement is the environment-by-key lookup: the UNION of the Environment and EnvironmentAPIKey queries with ~100 selected columns. pg_stat_activity shows it active with no wait event, i.e. CPU. EXPLAIN ANALYZE of the logged statement:
jit |
Execution |
|---|---|
| on (default) | 2,840 ms |
| off | 2.4 ms |
It runs on every per-process cache miss, so more gunicorn workers make it more frequent.
Why it matters: the Python SDK's event sender uses a 3-second read timeout. Exposures sent during a slow lookup were retried and stored twice, or dropped (Failed to send 1 events, attempt 1 of 3: Read timed out. (read timeout=3)). On an experiment wired correctly, 3 of 20 conversions disappeared, which looks exactly like a wiring bug.
Fix that worked for us:
postgres:
image: postgres:15.5-alpine
command: ["postgres", "-c", "jit=off"]
After it: 0 of 120 requests over 1 s, max 0.22 s. Turning JIT off in the official compose file (or making that lookup a UNION ALL) would avoid it for everyone self-hosting.
- 主要语言
- Python
- 星标
- 9.9k
- 派生
- 658
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 168
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Flagsmith/flagsmith 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
Flagsmith/flagsmith#9119 · 1 条评论 ·
维护者通常 1 天内回复
-
Fix Button Alignment in SDK Installation Section可能已有人在做 @manueldezman 于 3 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 62/100
Flagsmith/flagsmith#9056 · 2 条评论 ·
维护者通常 1 天内回复
-
Cloud Python warehouse snippet omits the import needed by its short-lived-job guidance可能已有人在做 @jcd1991 于 4 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 75/100
Flagsmith/flagsmith#9045 · 1 条评论 ·
维护者通常 1 天内回复
-
Expose whether an organisation is blocked for API usage可能已有人在做 @PiUnknown 于 38 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
Flagsmith/flagsmith#8773 · 1 条评论 ·
维护者通常 1 天内回复
-
influx_query_manager doesn't catch ApiException, so Influx error responses 500可能已有人在做 @SAY-5 于 13 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
Flagsmith/flagsmith#8510 · 1 条评论 ·
维护者通常 1 天内回复
查看 Flagsmith/flagsmith 的全部 Issue
相似的 Issue
-
ui
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
维护者通常 1 天内回复
-
CI: MSYS2 jobs fail — mingw python3 package renamed upstream to python可能已有人在做 @ronaldtse 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 76/100
pydantic/pytest-examples#102 · 1 条评论 ·