Unexpectedly poor cache performance
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- docker, go
- 领域
- backend, performance
调研方向
首先,使用提供的 ab 命令重现 cache-handler 配置,比较小图像在缓存和未缓存情况下的吞吐量。调查报告中描述的缓存指令和存储后端行为;完成的标准是找出变慢的原因,并验证性能改进,或明确记录一项限制。
由索引模型根据 Issue 内容生成。
描述
Caddy version: 2.9.1
The Problem:
When using the cache directive, the throughput of the given config block experiences a dramatic slowdown. On my system with 7950X testing using AB like so:
ab -k -t 60 -n 100000 -c 16 http://localhost:8080/image.png
Without caching: 85000-87000 requests per second
With caching: <3600 requests per second
image.png is a small (<20KiB) .png file of 185x250px dimensions.
Context:
For comparison, nginx in a similar scenario manages slower non-cached throughput (50-60k r/s), but dramatically faster cached throughput (15-17k r/s).
I tested versus nginx as my project presently uses its fork, Openresty (which is just nginx but with Lua scripting), to serve and cache static assets, and reverse proxy the main app. The expected production traffic consists of a high rate of requests against object storage backed image and thumbnail storage. It is crucial that this is cached (object storage egress costs money), and that the cache is performant enough to keep up with a high volume of requests.
If I were to switch to Caddy, the performance difference must not be too much worse.
The Config
{
cache
}
:80 {
route {
cache # the "no cache" test was done with this line commented-out
file_server {
root /var/www
}
}
}
Caddy is built via Docker like so:
ARG CADDY_VERSION="2.9.1"
FROM caddy:$CADDY_VERSION-builder-alpine AS builder
RUN xcaddy build \
--with github.com/caddyserver/cache-handler
FROM caddy:$CADDY_VERSION-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
EXPOSE 80
and ran like so
docker run --rm \
-it \
-v /home/luna/code/caddytest/config:/etc/caddy \
-v /home/luna/code/caddytest/data:/data \
-v /home/luna/code/caddytest/static:/var/www \
-p 8080:80 \
caddytest:latest
Needless to say, a very basic and barebones setup.
What I tried:
- Using a different storage backend for the caching module (tried otter, etcd)
- Putting it in a
handleblock - Using it without any
routeorhandleblocks
This performance discrepancy compared to our current setup with nginx is completely unacceptable and prevents me from moving ahead with using Caddy in production (as my resources rely caching having a high throughput).
- 主要语言
- Go
- 星标
- 396
- 派生
- 29
- 平均合并
- 32 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
caddyserver/cache-handler 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
caddyserver/cache-handler#138 · 1 条评论 · 3 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 76/100
caddyserver/cache-handler#143 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
caddyserver/cache-handler#140 · 4 条评论 · 1 个 reaction ·
-
难度 1/5 1 小时以内 新手友好度 45/100
caddyserver/cache-handler#139 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
caddyserver/cache-handler#137 · 1 条评论 ·
查看 caddyserver/cache-handler 的全部 Issue
相似的 Issue
-
kind/bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 4 天内回复
-
bug needs-acceptance
难度 2/5 1-3 小时 新手友好度 86/100
vllm-project/semantic-router#4744 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
jaegertracing/jaeger#9794 ·
维护者通常 1 天内回复
-
ScalingModifiers formula fails with "formula returned non-float result" when expression evaluates to an integer可能已有人在做 @Sarthak-Pandey 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复