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

feat: add support for static cache config #106

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Conversation

Ian2012
Copy link
Contributor

@Ian2012 Ian2012 commented May 29, 2024

Description

This PR allows the setup of a configurable static cache running on NGINX. Make sure to configure the following snippet to your nginx HTTP config:

proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=static-cache:32m use_temp_path=off max_size=4g inactive=24h;
proxy_cache_key $scheme$proxy_host$request_uri;
proxy_cache_lock on;
proxy_cache_use_stale updating;
proxy_ignore_headers Cache-Control;

Benchmarks:

Using k6 for fetching multiple static files.

Before:

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

     execution: local
        script: openedx-testing/mfe/request_static_files.js
        output: -

     scenarios: (100.00%) 1 scenario, 400 max VUs, 1m0s max duration (incl. graceful stop):
              * default: 400 looping VUs for 30s (gracefulStop: 30s)

     █ MFE static files

     data_received........: 413 MB 12 MB/s
     group_duration.......: avg=4.46s    min=2.07s    med=4.12s    max=9.52s p(90)=6.37s p(95)=7.88s
     http_req_duration....: avg=2.11s    min=192.17ms med=1.99s    max=6.37s p(90)=3.38s p(95)=3.95s
     http_req_failed......: 0.00%  ✓ 0          ✗ 4704 
     http_req_receiving...: avg=696.22ms min=71.23µs  med=154.75ms max=3.97s p(90)=1.85s p(95)=2.26s
     http_req_waiting.....: avg=1.41s    min=158.02ms med=1.31s    max=4.88s p(90)=2.31s p(95)=2.73s
     http_reqs............: 4704   132.536314/s
     vus..................: 3      min=3        max=400

After:

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

     execution: local
        script: openedx-testing/mfe/request_static_files.js
        output: -

     scenarios: (100.00%) 1 scenario, 400 max VUs, 1m0s max duration (incl. graceful stop):
              * default: 400 looping VUs for 30s (gracefulStop: 30s)

     █ MFE static files

     data_received........: 768 MB 22 MB/s
     group_duration.......: avg=1.88s    min=285.36ms med=1.45s    max=12.83s p(90)=4.22s    p(95)=5.14s   
     http_req_duration....: avg=864.04ms min=133.68ms med=333.14ms max=9.8s   p(90)=2.2s     p(95)=3s      
     http_req_failed......: 0.00%  ✓ 0          ✗ 8756 
     http_req_receiving...: avg=617.4ms  min=94.65µs  med=5.2ms    max=8.47s  p(90)=1.92s    p(95)=2.65s   
     http_req_waiting.....: avg=246.54ms min=132.95ms med=154.04ms max=3.15s  p(90)=510.83ms p(95)=768.91ms
     http_reqs............: 8756   253.325541/s
     vus..................: 7      min=7        max=400

@Ian2012 Ian2012 requested a review from a team as a code owner May 29, 2024 16:38
@Ian2012 Ian2012 force-pushed the cag/static-cache branch 13 times, most recently from c9b03a6 to ebe34ec Compare May 29, 2024 18:20
drydock/plugin.py Outdated Show resolved Hide resolved
drydock/plugin.py Outdated Show resolved Hide resolved
drydock/patches/kustomization-resources Outdated Show resolved Hide resolved
@Ian2012 Ian2012 force-pushed the cag/static-cache branch from ac3dc19 to 7777efb Compare June 20, 2024 20:58
@Ian2012 Ian2012 requested a review from marbonilla June 21, 2024 19:07
fix: address PR suggestions

fix: address PR suggestions

fix: address PR suggestions

fix: address PR suggestions

build: correct port and path for mfe tests
@Ian2012 Ian2012 force-pushed the cag/static-cache branch from 1df8bc7 to e331e29 Compare July 2, 2024 15:47
@jfavellar90 jfavellar90 merged commit 01d05ec into main Jul 2, 2024
4 checks passed
@jfavellar90 jfavellar90 deleted the cag/static-cache branch July 2, 2024 20:25
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

Successfully merging this pull request may close these issues.

3 participants