Skip to content

feat(amber): set cache-control headers for static frontend assets#5846

Open
Ma77Ball wants to merge 11 commits into
apache:mainfrom
Ma77Ball:feat/static-asset-cache-headers
Open

feat(amber): set cache-control headers for static frontend assets#5846
Ma77Ball wants to merge 11 commits into
apache:mainfrom
Ma77Ball:feat/static-asset-cache-headers

Conversation

@Ma77Ball

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • Add StaticAssetCacheFilter, registered on /* in TexeraWebApplication, that sets Cache-Control on static frontend responses by request path.
  • index.html, the root, and Angular route paths get no-cache, must-revalidate so a stale entry document is never served past a deploy; content-hashed bundles (name..js/.css and other fingerprinted assets) get public, max-age=31536000, immutable; /api/* responses are left untouched.
  • The Cache-Control decision lives in a pure StaticAssetCacheFilter.cacheControlFor(path) function so it is unit-testable without a servlet container.

Any related issues, documentation, discussions?

Closes: #5835

How was this PR tested?

  • Run sbt "WorkflowExecutionService/testOnly *StaticAssetCacheFilterSpec" on JDK 17, expect 7 passing cases: hashed js/css/media to immutable, index.html and Angular routes to revalidate, /api/* untouched, and short numeric segments not mistaken for a content hash.
  • Manual: build the frontend, start dashboard-service, run curl -I http://localhost:8080/index.html and expect Cache-Control: no-cache, must-revalidate; curl -I a hashed bundle (e.g. /main..js) and expect Cache-Control: public, max-age=31536000, immutable.
  • The servlet registration in TexeraWebApplication.run is covered by the manual curl steps, not the unit spec (the spec covers the header-decision logic).

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.8 in compliance with ASF

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 2 better · 🔴 7 worse · ⚪ 6 noise (<±5%) · 0 without baseline

Compared against main 6eb4165 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 403 0.246 24,052/31,349/31,349 us 🔴 -7.4% / 🟢 -10.4%
🔴 bs=100 sw=10 sl=64 822 0.502 119,526/148,059/148,059 us 🔴 +19.1% / 🔴 -7.8%
bs=1000 sw=10 sl=64 944 0.576 1,062,736/1,085,949/1,085,949 us ⚪ within ±5% / 🔴 -9.3%
Baseline details

Latest main 6eb4165 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 403 tuples/sec 435 tuples/sec 410.82 tuples/sec -7.4% -1.9%
bs=10 sw=10 sl=64 MB/s 0.246 MB/s 0.265 MB/s 0.251 MB/s -7.2% -1.9%
bs=10 sw=10 sl=64 p50 24,052 us 22,887 us 23,785 us +5.1% +1.1%
bs=10 sw=10 sl=64 p95 31,349 us 33,479 us 34,980 us -6.4% -10.4%
bs=10 sw=10 sl=64 p99 31,349 us 33,479 us 34,980 us -6.4% -10.4%
bs=100 sw=10 sl=64 throughput 822 tuples/sec 871 tuples/sec 891.94 tuples/sec -5.6% -7.8%
bs=100 sw=10 sl=64 MB/s 0.502 MB/s 0.531 MB/s 0.544 MB/s -5.5% -7.8%
bs=100 sw=10 sl=64 p50 119,526 us 114,220 us 112,277 us +4.6% +6.5%
bs=100 sw=10 sl=64 p95 148,059 us 124,355 us 139,802 us +19.1% +5.9%
bs=100 sw=10 sl=64 p99 148,059 us 124,355 us 139,802 us +19.1% +5.9%
bs=1000 sw=10 sl=64 throughput 944 tuples/sec 932 tuples/sec 1,041 tuples/sec +1.3% -9.3%
bs=1000 sw=10 sl=64 MB/s 0.576 MB/s 0.569 MB/s 0.635 MB/s +1.2% -9.3%
bs=1000 sw=10 sl=64 p50 1,062,736 us 1,075,520 us 972,714 us -1.2% +9.3%
bs=1000 sw=10 sl=64 p95 1,085,949 us 1,107,212 us 1,023,057 us -1.9% +6.1%
bs=1000 sw=10 sl=64 p99 1,085,949 us 1,107,212 us 1,023,057 us -1.9% +6.1%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,496.27,200,128000,403,0.246,24051.75,31348.63,31348.63
1,100,10,64,20,2431.99,2000,1280000,822,0.502,119525.99,148059.24,148059.24
2,1000,10,64,20,21178.18,20000,12800000,944,0.576,1062735.67,1085948.95,1085948.95

@codecov-commenter

codecov-commenter commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.91304% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.32%. Comparing base (6eb4165) to head (b90cf72).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...a/org/apache/texera/web/TexeraWebApplication.scala 0.00% 4 Missing ⚠️
...org/apache/texera/web/StaticAssetCacheFilter.scala 89.47% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5846      +/-   ##
============================================
- Coverage     54.42%   54.32%   -0.11%     
+ Complexity     2891     2890       -1     
============================================
  Files          1107     1103       -4     
  Lines         42768    42635     -133     
  Branches       4599     4588      -11     
============================================
- Hits          23276    23160     -116     
+ Misses        18130    18120      -10     
+ Partials       1362     1355       -7     
Flag Coverage Δ *Carryforward flag
access-control-service 70.44% <ø> (ø) Carriedforward from ed22158
agent-service 34.36% <ø> (ø) Carriedforward from ed22158
amber 56.34% <73.91%> (+0.03%) ⬆️
computing-unit-managing-service 1.65% <ø> (ø) Carriedforward from ed22158
config-service 57.35% <ø> (ø) Carriedforward from ed22158
file-service 57.36% <ø> (-1.24%) ⬇️ Carriedforward from ed22158
frontend 48.02% <ø> (-0.26%) ⬇️ Carriedforward from ed22158
pyamber 90.15% <ø> (-0.05%) ⬇️ Carriedforward from ed22158
python 90.76% <ø> (ø) Carriedforward from ed22158
workflow-compiling-service 58.69% <ø> (ø) Carriedforward from ed22158

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ma77Ball Ma77Ball marked this pull request as ready for review June 21, 2026 07:28
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @aicam
    You can notify them by mentioning @aicam in a comment.

@Ma77Ball

Copy link
Copy Markdown
Contributor Author

/request-review @Yicong-Huang

@github-actions github-actions Bot requested a review from Yicong-Huang June 22, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set cache headers for index.html and hashed assets to prevent stale-bundle loads

2 participants