-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Support for serving static assets over a CDN #72880
Comments
Pinging @elastic/kibana-operations (Team:Operations) |
Another thought on this: adding CDN support would allow us to take advantage of HTTP/2 for loading assets without requiring the Kibana server to support it or for the customer to configure HTTPS (which is required by most browsers to use HTTP/2). Loading assets is the area where we believe HTTP/2 would help us the most and most CDN services support HTTPS and HTTP/2 out of the box and this could be one of the quickest paths to get there. In addition, having a CDN should allow us to side-step the issue where browsers will not cache assets from an origin using a self-signed certificate. If the assets are loaded from an origin using a cert from a trusted CA, the browser should cache these assets. If we explore this path, I think it would be beneficial to also explore the possibility of having a pre-configured CDN that Elastic hosts and controls for Basic+ users. We would need to explore the long-term costs of this (which may be hard to estimate!), but a fast-by-default experience sounds enticing. For air-gapped installations, we will need to support a fall-back to the existing mechanism. If there is a demand for it, we can also explore allowing air-gapped installations configure their own CDN. |
another usecase for this is reporting, currently we generate report (csv/pdf) and store it back into elasticsearch, which is very inefficent and also bring limits on the size of report we can generate. Having a CDN where we could put the reports would be great. |
Pinging @elastic/kibana-core (Team:Core) |
Realized this was tagged Ops. I think it makes the most sense for Core to implement (correct me if I'm wrong). We can own making the release manager changes to get the assets deployed to a bucket to be used on Cloud. |
I see |
|
I do agree with @vadimkibana that the |
I'm not sure "impact" should be implied from priority or from the timing for when the task is scheduled. Even if this task is not planned for in the near future or at all, IMO, it is still very high impact. The description of the label is probably a bit misleading, we might want to change it. |
@vadimkibana @lizozom Do we have any numbers to justify the |
@mshustov I'm not sure it is something that needs numbers to justify it. Serving static immutable files from application server is just not something you do. IMO, you always want to have static files in a blob storage and be served efficiently through a CDN. Kibana is a product that can be self-managed, so it made sense initially for Kibana to server the files (as there is no other way), but with the cloud-first approach, I don't see a reason why in Elastic Cloud the static Kibana files would not be served from a CDN, especially if they are immutable (the same for all deployments). Some justification numbers:
|
re-added ops team since @tylersmalley mentioned them helping out with the deployment strategy side. |
We now have some production stats from APM about page load times (uncached sessions only) by geo, to help us justify the importance of this change: Page load time is up to x2 for Europe, Asia and Oceania compared to the US. (all charts are obviously in MS and not in seconds) USA vs. everywhere else: Breakdown by continent: Breakdown by country: |
@lizozom What do |
I'm sorry but I have to ask: what is expected from the Kibana side on this matter exactly? I'm no CDN expert, but for having used some of them on quite a few projects, CDN/Asset caching can usually be addressed without architecture changes, as it's mostly infrastructure based with caching policies/rules at the CDN's level (well at least for self-populating CDNs, but I doubt any CDN solution is not self-populating in 2022). As already said in the description, all our bundles' paths are prefixed with the build hash (and now plugin version), making it really easy to introduce a caching policy on any CDN that Cloud may want to use for basically Other static assets, like fonts, aren't prefixed (yet) with that, but we can also imagine a per-Kibana-version caching strategy, with each Kibana deployment on Cloud using the correct CDN configuration depending on their version. So, I apologize in advance if the question is stupid but, what exactly is expected from us here? It looks like a Cloud's problematic to me, and I'm not sure how we're supposed to be the main actor here? Are we supposed to investigate which CDN solution Cloud may want to use? |
After taking a quick look of the 'static' assets we're currently serving from Kibana: What are our served assetsjavascripts bundlesThis part is kinda ready:
We may eventually want a bootstrap scriptThis one has (historically) been served from core static assetsWe have two static folders exposed from kibana/src/core/server/core_app/core_app.ts Lines 199 to 204 in 01ff431
These are not currently using a Note that atm, the plugins assetsPlugins can define a These ones are the most problematic, because these paths are directly used from the plugin's code, e.g kibana/src/plugins/home/public/application/components/solutions_section/solution_panel.tsx Lines 26 to 27 in f80104d
so changing the path to support a buildNum based prefix would require to change all access to these files from the code. If we want to do so, we should probably expose a utility function from Note: I couldn't remember what system is used to expose those Is there more?Did I miss anything in that list? What are we expecting from Kibana on this matter?This is what I don't get exactly from this issue's initial description. My first question is: are we focusing on Cloud here, or is the purpose of this issue to allow the usage of a CDN also for our on-premise customers? Depending on the question, the approaches can be sensibly different.
Most modern CDNs are self-populating. Should we, once we've made the adjustment to have most of our assets served by a unique buildNum-based path, just document which paths are safe to be allowlisted in a CDN system, and maybe provide example rules for the most commons of them?
Are we expecting an active assets extraction, that will generate the exact folder of assets that can be pushed to/served by a CDN? @stacey-gammon (and other contributors of this issue) maybe you have more context on what exactly would be expected from us here? |
I'd like to come up with a plan to leverage a CDN for cache-ready assets in Cloud. That would be our primary driver. If that process also yields some CDN-ready documentation and capabilities for self-managed, that would be nice. @pgayvallet your comment above is a wonderful beginning to seriously thinking about how to get Kibana, running on Cloud, CDN-ready. Great content! @stacey-gammon and I can start reaching out to other teams to figure out what approach we'd like to take for utilizing a CDN. |
Thanks @pgayvallet. Good to see that we're getting close to supporting CDN asset serving (on cloud and potentially on prem). I wonder, given the current state of things in Kibana, if we should get someone from the cloud\cloud infra teams involved. They would probably be able to shed some light on what the challenges from their side are. @mfinkle Any clue who the appropriate teams \ people would be? |
Just an update: We have a good current state and direction forward (thanks again @pgayvallet). We've reached out to the folks in SRE that work with Elastic's CDN to establish a connection. We have not prioritized this work yet. As we get more of our clusters collecting APM data, we can create a cost benefit basis to justify creating a real plan and priority. For now, I don't think we are ready to put the work in a project and on a roadmap. |
@jloleysens has a PR up adding some initial support for configuring Kibana to request static assets from another domain: #169408 |
The CDN is ready for testing - see #173159 (comment) for details. |
Yeah @jbudz! |
## Summary Part of #72880 - Generate translation files for all locales (including all internal plugins) during the CDN asset generation task - Adapt the `rendering` service to use the translation files from the CDN if configured/enabled ### How to test Connect to the serverless project that was created for the PR, and confirm the translation file is being loaded from the CDN <img width="907" alt="Screenshot 2024-04-25 at 15 55 23" src="https://github.com/elastic/kibana/assets/1532934/5a6d9110-2e92-41e5-b066-e792e0015134"> --------- Co-authored-by: kibanamachine <[email protected]>
@jloleysens should we consider this as completed? |
Even though there are refinements and improvements planned (like rolling out to Cloud) I believe we have achieved the original intent of this issue. |
With the change to including the build number in the asset path, we can now support serving these assets through a CDN. This would drastically decrease the noise and load on the Kibana server, while hopefully improving performance.
This should be something we can launch with on Cloud.
The text was updated successfully, but these errors were encountered: