Embed visualization loads a ton js files

I am embedding a visualization in a website and looking at the network tab of chrome, kibana loads 97 JS files. Most of them are under a directory called 31997. I guess that is some kind of version number.
Is this normal behavior?
Can I somehow bundle them into one JS file called 31997.js?

Hi, @jodinathan.

Is this normal behavior?

Yes, this is a byproduct of the Kibana plugin system. Worth noting that from Kibana v7.8 all the js bundles are cached in the production with cache-control: max-age=31536000 so that on subsequent visits to the page, resources will not be loaded again.

Can I somehow bundle them into one JS file called 31997.js?

Wouldn't the Kibana cache policy address the loading problem?

Yeah, browser cache will probably help a lot. I've put a page rule in cloudflare so all js files at kibana url are cached. So Kibana won't have to send it.
However, I would still work something regarding it.
When I was testing Kibana to know if it was suitable for our project I've felt it way too slow, even in a local container. So my first thought was that it was way too heavy to be embeddable.

Kibana makes ~140 requests, 97 being only JS.

Dunno the quirks within Kibana, but in a quick thinking I would give a tag name for each included JS file and, on each include, check for that tag to know if the file have already been included, and finally, with something like webpack, build all js files within the dir/31997* in a js bundle file.

When I was testing Kibana to know if it was suitable for our project I've felt it way too slow, even in a local container. So my first thought was that it was way too heavy to be embeddable.

I do agree that there is a place for improvements. We are working on the problem and improve perf metrics for every release
[Meta] Kibana platform performance · Issue #63848 · elastic/kibana · GitHub
It seems that you already use v7.8, the next v7.9 version that should be released in a month will have smaller bundles (about -25% of the current size).

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.