-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Serve a slimmer core-only bundle for Kibana Platform applications #60580
Comments
Pinging @elastic/kibana-operations (Team:Operations) |
Pinging @elastic/kibana-platform (Team:Platform) |
I really like this idea. Step one seems easy enough if we can isolate and remove the places where legacy code is required by the core. I'm not sure how we'll be able to handle the second step, because I'm pretty sure that there are cases where we need the legacy code to be loaded for new platform application, no? |
I don't believe so. On the client, I believe the only legacy code we import is already done conditionally based on whether or not we're rendering a legacy application:
We can probably configure webpack in @kbn/optimizer to use empty modules for these specific paths. Since they'll never actually be imported in this case, that should work fine. The only other place I can think of where we have the potential to import legacy code is in the entry point template: https://github.com/elastic/kibana/blob/master/src/legacy/ui/ui_bundles/app_entry_template.js#L47 I'd have to double check, but I believe this array is empty for the "core bundle" that is created here: https://github.com/elastic/kibana/blob/master/src/legacy/ui/ui_bundles/ui_bundles_controller.js#L102 For the entry point we'd create for this core-only bundle, we can just set that Anything else I could be missing? |
Do you think we could move the whole Then we could just continue to disallow legacy stuff in the |
Good idea. We can't move the everything that is in the legacy service right now, because it still does do some things we need like registering legacy applications with the nav. As far as Core is concerned, Legacy apps are really just dumb navlinks, they don't have any actual legacy code associated with them. But we could parameterize the legacy modules that it imports ( I'll take a swing at that first step! |
Sounds like the correct approach to me. It seems the list is exhaustive, so we only have to do that for 3 modules, seems reasonable. Another minor point:
If we move the |
Would it solve #58327 ? |
Either solution should, once the core can be imported and built by |
I've put up a working POC here: #61011 Still need to update some internal core tests, but feedback is welcome. Preliminary results in dev mode are promising (take a look at the MB transferred): Once this improvement goes in, by far the next biggest opportunity is to reduce the queue time incurred by the large number of requests required to load plugins. This could be solved by either adding HTTP/2 support or concatenating all plugin bundles into a single request (#55241). |
As more plugins migrate to the New Platform and the addition of the new optimizer system, our frontend JS bloat is growing larger.
We should be able to conditionally serve a different JS entry point and other JS bundles for bootstrapping the frontend of Kibana based on whether or not we are mounting a legacy application. This could potentially significantly cut down on how much JS we send to the client on initial bootstrap for most use cases.
Steps to making this possible:
Related issues:
The text was updated successfully, but these errors were encountered: