Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

皮肤库列表的性能问题 #614

Open
1 task
tnqzh123 opened this issue Feb 1, 2024 · 0 comments
Open
1 task

皮肤库列表的性能问题 #614

tnqzh123 opened this issue Feb 1, 2024 · 0 comments

Comments

@tnqzh123
Copy link
Member

tnqzh123 commented Feb 1, 2024

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

重现步骤

见上方问题描述

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant