Open
Description
Blessing Skin 版本
866e182 @ dev branch
PHP 版本
8.1
出现问题时所使用的浏览器
Microsoft Edge
您正在使用的 Web Server
Nginx
您正在使用宝塔吗?
- 是
出现了什么问题?
随着 users 表和 textures 表数据的增多,/skinlib/list
的响应速度越来越慢。
根据我对目前国内较大的几个皮肤站的观察(均为国内服务器),在 TTFB 不计算 DNS 查询时间、TCP 握手时间和 SSL 握手的时间的情况下:
- LittleSkin 当前拥有 1466K+ 用户、357K+ 材质,
/skinlib/list
的 TTFB 约 1300~1800ms; - 红石皮肤站(https://mcskin.cn)当前拥有 206K+ 用户、52K+ 材质,
/skinlib/list
的 TTFB 约 800~1200ms; - MUA 用户中心(中国 Minecraft 高校联盟皮肤站,https://skin.mualliance.ltd)当前拥有 2K+ 用户、1.3K+ 材质,
/skinlib/list
的 TTFB 约 120~200ms;
通过观察可以得出,/skinlib/list
的 TTFB 时间与皮肤站所拥有的用户数量及材质数量成正比。
打开 APP_DEBUG 后通过 Debug Bar 发现请求一次 /skinlib/list
一共执行了两条 SQL:
select count(*) as aggregate from "textures" inner join "users" on "uid" = "uploader" where "type" in ('steve', 'alex') and "public" = 1
select "tid", "name", "type", "uploader", "public", "likes", "nickname" from "textures" inner join "users" on "uid" = "uploader" where "type" in ('steve', 'alex') and "public" = 1 order by "upload_at" desc limit 20 offset 0
在 users 表和 textures 表较大的情况下,执行第一条 SQL 的耗时远超第二条。
错误日志
No response
重现步骤
见上方问题描述
Metadata
Assignees
Labels
No labels
Activity