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

[SDH] Cache-Control optimizations #64518

Closed
wants to merge 1 commit into from

Conversation

afharo
Copy link
Member

@afharo afharo commented Apr 27, 2020

Summary

Our Cache policy for serving JS and CSS bundled assets is "must-revalidate", enforcing every request to actually reach the Kibana server to revalidate the the etag via the If-None-Match header.

This makes Kibana super slow under connections with a high latency. It is easy to check with the network throttling the Dev Tools: In Chrome, if you set it to limit the network speed to Slow 3G, you can tell that, even when all the requests receive a 304 response, it takes MINUTES!! to load all the resources in the Home application:
image
Mind the timings in the bottom of the screenshot

I tested locally changing the cache policy to cache-control: max-age=30; must-revalidate (allow the browser to use the local files if they were validating less than 30s ago). With this, if I refresh the page before those 30s expire, the load time (with the throttling still on) is highly reduced:
image

Maybe we want to mark the assets as stale as soon as they are served but allow the browsers to use them to load the pages as quick as possible while revalidating and downloading in the background. This PR adds a combination of stale-while-revalidate with max-age and must-revalidate?

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@afharo
Copy link
Member Author

afharo commented Apr 27, 2020

Feel free to close this PR if you feel like this is not the way to go. Since I was playing around with the properties, I decided it would be good not to lose this in case we wanted to apply it.

@afharo afharo marked this pull request as ready for review April 27, 2020 16:46
@afharo afharo requested a review from a team as a code owner April 27, 2020 16:46
@afharo afharo added the Team:Operations Team label for Operations Team label Apr 27, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@afharo afharo added the enhancement New value added to drive a business result label Apr 27, 2020
@jbudz
Copy link
Member

jbudz commented Apr 27, 2020

awesome! it's not not the way to go, you're certainly right about the round trip. @restrry opened another approach here if you have any thoughts and want to weigh in.

@restrry if you get a chance can you triage this? adding the platform label too.

@jbudz jbudz added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Apr 27, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@pgayvallet
Copy link
Contributor

pgayvallet commented Apr 28, 2020

Probably superseeded by #64414. @restrry do you confirm?

EDIT: didn't see @jbudz comment, sorry for the double ping.

@mshustov
Copy link
Contributor

yes. #64414 is aimed to solve the same problem.

@afharo
Copy link
Member Author

afharo commented Apr 28, 2020

Thanks for confirming! Closing this PR then.

@afharo afharo closed this Apr 28, 2020
@afharo afharo deleted the sdh/cache-optimization branch April 28, 2020 09:36
@afharo afharo restored the sdh/cache-optimization branch April 28, 2020 09:36
@afharo afharo deleted the sdh/cache-optimization branch October 1, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result release_note:enhancement Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Operations Team label for Operations Team v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants