core: Some integrations are slow to finish startup

The problem

SQL keeps topping my startup time list since 2022.8.0b0 (same on b3):

edit: it appears to be more generic than just SQL. I am seeing major startup delays on 2022.8 that don’t show on 2022.7. At first I thought it was only the SQL sensor, but by comparing it looks like many integrations are way slower to start. First image is 2022.8, 2nd image is 2022.7. I expect multicrape and restful to be slower by nature (they’ll never get close to 1 second), but these also doubled in startup time

Running container, no changes to the host or so between switching image versions. 2022.8: image

2022.7: 2022 7

What version of Home Assistant Core has the issue?

core-2022.8.0b0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Link to integration documentation on our website

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Logger: homeassistant.bootstrap
Source: bootstrap.py:435
First occurred: 12:58:22 (1 occurrences)
Last logged: 12:58:22

Waiting on integrations to complete setup: sql, rest, hacs, mqtt, multiscrape, rituals_perfume_genie, xiaomi_miio, version, waze_travel_time, picnic, esphome

Logger: homeassistant.setup Source: runner.py:119 First occurred: 12:57:31 (2 occurrences) Last logged: 12:57:46

Setup of rest is taking over 10 seconds. Setup of multiscrape is taking over 10 seconds.

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 31 (30 by maintainers)

Most upvoted comments

I think my issue was music assistant. The current beta is an add-on and for me it’s much better now. Scherm­afbeelding 2023-03-28 om 11 05 32

The problem, at least for most cases is likely fixed by https://github.com/home-assistant/core/pull/90335

Because sql startup blocked the event loop it was affecting nearly everything. Once that’s fixed all integrations that start at the same time as sql should start much faster

I’m still seeing slow startup of SQL among other things. Right now on 2023.3.3 running Home Assistant Container on an RPi 4. Only two MQTT devices and the MQTT integration doesn’t seem to take too long to start. I’ll try to get a py-spy.

image