Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow integrations are hard to diagnose #4321

Closed
1 task done
altano opened this issue Aug 14, 2022 · 7 comments · Fixed by #4445
Closed
1 task done

Slow integrations are hard to diagnose #4321

altano opened this issue Aug 14, 2022 · 7 comments · Fixed by #4445
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@altano
Copy link
Contributor

altano commented Aug 14, 2022

What version of astro are you using?

1.0.5

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

Can we log when integrations are running?

I introduced a performance regression to my own Astro mdx remark plugin, @altano/remark-astrojs-image, that caused the @astrojs/image integration to take ~100 seconds. The whole site seems to build in seconds but then it gets stuck for ~90+ seconds just sitting here, with no logging output:
image

I can fix my plugin, but I'm a little concerned that an end-user might hit this and have a hard time diagnosing the problem. If it's a third-party integration that is misbehaving they won't even know. Using --verbose doesn't seem to give me any extra output that would help me diagnose what operation is taking so long.

Simply having log output while awaiting the integration's astro:build:done hook should be sufficient.

Link to Minimal Reproducible Example

n/a

Participation

  • I am willing to submit a pull request for this issue.
@natemoo-re
Copy link
Member

Yep, this is absolutely something we need to fix! Thanks for filing an issue.

@natemoo-re natemoo-re added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Aug 15, 2022
@tony-sull
Copy link
Contributor

Not a one size fits all solution, but I just opened #4342 with a logger I had been working on for @astrojs/image (the most likely culprit for most of these issues today)

@bholmesdev
Copy link
Contributor

Agreed this is an issue! I'm thinking about a "Waiting for X integration..." log across all of our build hooks in case something takes longer than expected. Say, log on a 3 second timeout. PR coming shortly!

@altano
Copy link
Contributor Author

altano commented Sep 4, 2022

Agreed this is an issue! I'm thinking about a "Waiting for X integration..." log across all of our build hooks in case something takes longer than expected. Say, log on a 3 second timeout. PR coming shortly!

Both fixes work fantastically, thanks! 🔥

@PeteJStewart
Copy link

I'm still finding my build time to be about 5 minutes.
I agree that the main culprit is image optimisation. I'm actually using both astro-imagetools & @astrojs/image,
as I need more precise art direction for some images.

You can see that a large part of the build time is due to 6 images optimised by @astrojs/image.

09:18:10.314 | optimizing 6 images in batches of 4
-- | --
09:18:13.291 | 09:18:13 AM [build] Waiting for the @astrojs/image integration...
09:19:37.441 | Completed in 87.13s.
09:19:37.443 |  
09:19:37.445 | Completed in 98.87s.

@altano
Copy link
Contributor Author

altano commented Nov 3, 2022

Are those images gifs? I found sharp to be extremely slow at optimizing gifs, which is apparently a known issue. @astrojs/image has caching now (see PR)... is that helping reduce subsequent build times?

@PeteJStewart
Copy link

They're not gifs, but they are all on a remote server, so perhaps that's part of the issue.
I haven't found @astrojs/image to be any faster, I've updated to the latest version, and just run my second build on that version.
Still finding it to hang on:
Waiting for the @astrojs/image integration...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants