-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
perf: optimizing request plugin bundle resources #4639
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4639 +/- ##
============================================
+ Coverage 60.95% 61.02% +0.07%
Complexity 2610 2610
============================================
Files 379 379
Lines 13551 13612 +61
Branches 961 960 -1
============================================
+ Hits 8260 8307 +47
- Misses 4827 4838 +11
- Partials 464 467 +3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/lgtm |
/ping @halo-dev/sig-halo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里用 etag 能否解决问题呢?如果可以的话,可能就不需要缓存 js 和 css 到本地磁盘。
这里的问题与 http 缓存没有关系,主要是慢在每次访问bundle的时候需要去所有插件里面读取文件然后合并而去所有插件里面读取main.js和style.css的这个过程可以简化,作出的优化就是只合并一次写入到一个文件下次访问就只读取一个文件减少了IO次数,如果插件有变化那就再去重新读取并合并更新到文件以此类推 |
了解了。 |
application/src/main/java/run/halo/app/core/extension/endpoint/PluginEndpoint.java
Outdated
Show resolved
Hide resolved
要在生产模式下才有用, 开发模式下资源随时都会变所以不会缓存 |
c2ff3c3
to
221fb47
Compare
application/src/main/java/run/halo/app/core/extension/endpoint/PluginEndpoint.java
Outdated
Show resolved
Hide resolved
application/src/main/java/run/halo/app/core/extension/endpoint/PluginEndpoint.java
Show resolved
Hide resolved
application/src/main/java/run/halo/app/core/extension/endpoint/PluginEndpoint.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JohnNiang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind improvement
/area core
/milestone 2.10.x
What this PR does / why we need it:
优化插件捆绑资源的查询性能
在插件 js bundle 1.2M 大小的情况下:
优化前:
优化后:
how to test it?
在插件生产模式下使用此 PR 测试,比对与不使用此 PR 的 API 速度,且检查 js bundle 和 css bundle 的资源是否正确加载。
Does this PR introduce a user-facing change?