Frontend: Performance Issues & Memory Leaks with device / entity drop downs.

Created on 25 Nov 2020  路  5Comments  路  Source: home-assistant/frontend

Checklist

  • [x] I have updated to the latest available Home Assistant version.
  • [x] I have cleared the cache of my browser.
  • [x] I have tried a different browser to see if it is related to my browser.

The problem

All Entity and Device dropdown are insanely slow to load and freeze the browser to the point I can't right click the page or select an entity for a considerable amount of time. This has only gotten worse the more devices I've integrated.

image

Expected behavior

The user interface and drop downs shouldn't freeze.

Steps to reproduce

  1. Use the log book (or state viewer, love lace entity picker or automation editor).
  2. Type to select an entity (notice slight lag).
  3. Start deleting the entity id with backspace/delete, Mix it up and delete a few characters in from the end and then select all text and delete. I seem to get into this more and more with deletes, and everything becomes slower even selection.
  4. Start typing a new entity id (it starts getting worse every iteration)
  5. Keep repeating #2-4.

I also sometimes see this issue when I paste in the full entity id into a dropdown. It's not consistent, but over time I will have to reload the browser and be frustrated the whole time.

Environment

I notice this mostly on Safari (14.0.1) but have been able to reproduce on chrome (it takes longer to reproduce and isn't as noticeable). I've seen this both on PC running windows 10 (Ryzen 9 5900x) and Mac OS (2018 6core i7 MBP).

  • Home Assistant release with the issue: All-0.118.3
  • Last working Home Assistant release (if known):
  • Browser and browser version: Safari - Version 14.0.1 (16610.2.11.51.8) / Chrome- Version 87.0.4280.67 (Official Build) (x86_64)
  • Operating system: Mac OS - Big Sur / Windows 10

State of relevant entities

There are way to many entities to list here, but they are in all different kind of states from unavailable (a few). The ones I'm selecting are all available and mostly motion sensors.

Additional information

I have ~1630 entities and ~366 devices that show up in the config/entities lists. There is nothing that I can think of that would be causing this to be slow hardware wise. HA is running on a NUC 10 and I've been able to reproduce the client side issues on my high end desktop (12 Core Zen 3 5900x).

Safari

safari-timeline.zip

image

Here is a view of longest time taken while the cpu is going crazy:

image

Chrome

image

I have a hunch it has to do with massive lists of entities/devices and them all being loaded / rendered and then a bug in the filtering with deletes / adds.

bug

Most helpful comment

Awesome. I will try to reproduce this sometime in the next week

All 5 comments

@bdraco Did you create an integration to mock having over 1000 entities? Might be useful here to see if we can reproduce this

Awesome. I will try to reproduce this sometime in the next week

Using Bdraco's Scale Test Component I was able to create 1600 extra entities.

I can definitely tell there is some lag in loading all pages but I can also reproduce the lag in the Logbook.

It seems to slow down a bit for me. Definitely not an unusable point but I can see a slow down. Seems to just stutter or lag a bit. I was unable to find it keep growing in memory but the scale test doesn't add any logbook history (not really possible I don't think) so maybe that would make the difference there. I am not sure what to do about the slowdown or what could make it better though. Nothing sticks out to me as obvious. The response from the backend seems pretty quick to pull the data when I do have history for an entity.

@bramkragten may have some more insight on what we can do to help performance overall

I see that but I also see it really go crazy when you try deleting the partial. Say you have entity named sensor.back_door_motion, type that in and then delete tion from the end, then delete _door then select all text and hit the delete key. Try it a few times.

Was this page helpful?
0 / 5 - 0 ratings