# Embed visualization loads a ton js files

**URL:** <https://discuss.elastic.co/t/embed-visualization-loads-a-ton-js-files/241368>\
**Category:** Kibana\
**Created:** [July 15, 2020, 10:13pm UTC](https://discuss.elastic.co/t/embed-visualization-loads-a-ton-js-files/241368 "2020-07-15T22:13:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jodinathan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jodinathan/32/45821_2.png) [@jodinathan](https://discuss.elastic.co/u/jodinathan)\
**Post date:** [July 15, 2020, 10:13pm UTC](https://discuss.elastic.co/t/embed-visualization-loads-a-ton-js-files/241368/1 "2020-07-15T22:13:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mikhail\_Shustov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikhail_shustov/32/49186_2.png) [@Mikhail\_Shustov](https://discuss.elastic.co/u/Mikhail_Shustov)\
**Post date:** [July 16, 2020, 7:26am UTC](https://discuss.elastic.co/t/embed-visualization-loads-a-ton-js-files/241368/2 "2020-07-16T07:26:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jodinathan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jodinathan/32/45821_2.png) [@jodinathan](https://discuss.elastic.co/u/jodinathan)\
**Post date:** [July 16, 2020, 12:25pm UTC](https://discuss.elastic.co/t/embed-visualization-loads-a-ton-js-files/241368/3 "2020-07-16T12:25:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mikhail\_Shustov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikhail_shustov/32/49186_2.png) [@Mikhail\_Shustov](https://discuss.elastic.co/u/Mikhail_Shustov)\
**Post date:** [July 16, 2020, 12:57pm UTC](https://discuss.elastic.co/t/embed-visualization-loads-a-ton-js-files/241368/4 "2020-07-16T12:57:01Z")

</div>

> 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](https://github.com/elastic/kibana/issues/63848)  
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).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 13, 2020, 1:02pm UTC](https://discuss.elastic.co/t/embed-visualization-loads-a-ton-js-files/241368/5 "2020-08-13T13:02:04Z")

</div>

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