Skip to content

[Emotion migration] Caching issue causing performance problems #218340

@tsullivan

Description

@tsullivan

Performance bug

As Kibana devs migrate SCSS code into Emotion (meta issue), folks have begun to notice performance issues at runtime.

When a component renders with Emotion styles, a new <style> tag is added to the head. The effect is that style tags accumulate as we navigate Kibana.

Quote from @mbondyra:

Over time, this can result in thousands of redundant <style> tags, which resembles a memory leak and can impact runtime performance. The more we adopt the rewrite, the more this issue scales—more style tags keep getting added but never removed when navigating between pages. It also means other teams can unintentionally slow down our apps just by adding styles to theirs, since styles persist across navigation.

Image

The investigation is still early at the time of this writing. In production, we're seeing styles being added with each plugin, not removed on unmount, but not being duplicated. Memoized components have their emotion style tags persisted. We're still looking into whether any styles are being duplicated. While going through several views we can reproduce 6900 style tags locally and the tab memory usage increased to 1.1GB.

Additional notes

Metadata

Metadata

Assignees

Labels

EUITeam:Platform-DesignTeam Label for Kibana Design Team. Support the Analyze group of plugins.Team:SharedUXPlatform AppEx-SharedUX (formerly Global Experience) t//

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions