Skip to content

[Meta] Reducing Kibana bundle sizes #88678

@Bamieh

Description

@Bamieh

I was checking opportunities for us to improve page load perofmance for kibana. This is a meta issue with some of my findings. We can create PRs or separate issues for tackling each one on the list individually. I only looked at package.json dependencies; maybe we can get rid of some devDependencies as well to reduce yarn install time in the future.

Bundle specific changes

Copied from #95853

One of our goals is to keep Kibana fast. A large part of this is to reduce the amount of Javascript that is downloaded and parsed on each page load. We have for some time provided bundle size metrics on pull requests. From the docs:

The size of the entry file produced for each bundle/plugin. This file is always loaded on every page load, so it should be as small as possible. To reduce this metric you can put any code that isn’t necessary on every page load behind an async import().

Code that is shared statically with other plugins will contribute to the page load bundle size of that plugin. This includes exports from the public/index.ts file and any file referenced by the extraPublicDirs manifest property.

Cross bundle changes

  • We have multiple encryption libraries (request-crypto, node-crypto, jsonwebtoken and node-forge) A lot of functionality is shared between these libraries, maybe we can get rid of node-forge in favor of node-crypto)

  • We have multiple http fetch libraries: nock, whatwg-fetch, node-fetch, request, load-json-file. Maybe it is worth exploring getting rid of most of those.

  • We have multiple glob libraries: glob, glob-all, globby, minimatch. They all have very similar feature set. Maybe we can explore the possiblity of only ussing 1 package.

  • We have multiple unique id generation packages: seedrandom, uuid. EUI also provides a helper as well to generate uuids. Maybe we can explore using 1 of them only.

  • We have many JSON helper tools: rison-node, JSONStream, deep-freeze-strict, fast-deep-equal, hjson, idx, object-hash, object-path-immutable, set-value. Some of those are only used in 1 place, maybe its worth exploring removing those big libraries.

  • We have two unzip libraries: yauzl, tar. Can we remove one of them?

  • We have at least five redux-like state management packages. [Discussion] State management tools in Kibana #101253

  • remove deprecated intl-relativeformat and update intl-messageformat to the version relying on the global Intl object. [i18n] React-Intl v3 soon out of beta #38642

  • font-awesome is no longer used in EUI. Do we have a plan to get rid of it completely?

  • We are using the complete lodash + few fp.lodash packages. Maybe we can encourage using the fp.lodash packages to only use what we need?

  • We have node APIs usages in client code that are polyfilled and bloat bundles "Buffer" polyfill bloats plugin bundles #107280

  • Use packages' target_web builds to ensure browser compatibility (Use target_web to ensure browser compatibility #130874)

Complete

Moving packages from dependencies to devDependencies is just for keeping things tidy. Operations filter down unused dependencies before bundling. Feel free to edit this issue ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//Team:OperationsKibana-Operations TeamdiscussenhancementNew value added to drive a business resultperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions