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

Jetpack: Atomic: JITMs significantly slowing down wp-admin loads #96940

Closed
ebinnion opened this issue Dec 2, 2024 · 10 comments
Closed

Jetpack: Atomic: JITMs significantly slowing down wp-admin loads #96940

ebinnion opened this issue Dec 2, 2024 · 10 comments
Assignees
Labels
[Experiment] AI labels added [Feature Group] Site Performance [Feature] JITM Just In Time Messages - pop-up tips and suggestions that appear on the dashboard and sidebar. [Feature] Plugins Features related to plugins on WordPress.com, including search, management, and installation. Groundskeeping Issues handled through Dotcom Groundskeeping rotations Needs triage Ticket needs to be triaged [Platform] Atomic [Pri] High Address as soon as possible after BLOCKER issues [Status] Auto-allocated [Status] Escalated to Product Ambassadors [Type] Bug When a feature is broken and / or not performing as intended

Comments

@ebinnion
Copy link
Contributor

ebinnion commented Dec 2, 2024

Quick summary

As I've loaded my wp-admin recently, I've noticed that it felt pretty slow. After installing query monitor, I noticed that there is often a JITM request that is happening during page generation. This call seems to often take ~3 seconds, but I recently had one that took over 6 seconds.

I haven't tracked down the source of the issue. My understanding is that JITMs previously loaded after the initial page load, so I'm not sure what exactly changed.

Of note, the screenshot that I'm sharing says the plugin that made the request is Jetpack Boost. But, keep in mind that with Jetpack packages, we could be using a package loaded from one of several Jetpack plugins that may be running on my site. Take note of the calypso:sites:sidebar_notice, which I assume is added by Atomic code somewhere.

Image

This occurred on eric.blog. For debugging purposes, I'm glad to give any a11n a temporary user account on that site.

Even worse than the slow request is that if I refresh the page, I can get the request to fire again multiple times.

cc @oskosk @inaikem for awareness. Also, hi friends. 👋

Steps to reproduce

  1. Have an atomic site
  2. Install Query Monitor or some other debug that shows HTTP API calls (perhaps covered by debug bar when proxied)
  3. Go to wp-admin

What you expected to happen

No page blocking http calls to be made.

What actually happened

The page blocking http call is made.

Impact

Some (< 50%)

Available workarounds?

No but the platform is still usable

If the above answer is "Yes...", outline the workaround.

No response

Platform (Simple and/or Atomic)

Atomic

Logs or notes

No response

@ebinnion ebinnion added [Type] Bug When a feature is broken and / or not performing as intended Needs triage Ticket needs to be triaged labels Dec 2, 2024
@github-actions github-actions bot added [Status] Escalated to Product Ambassadors [Platform] Atomic [Pri] High Address as soon as possible after BLOCKER issues [Feature Group] Site Performance [Feature] JITM Just In Time Messages - pop-up tips and suggestions that appear on the dashboard and sidebar. [Feature] Plugins Features related to plugins on WordPress.com, including search, management, and installation. labels Dec 2, 2024
Copy link

github-actions bot commented Dec 2, 2024

OpenAI suggested the following labels for this issue:

  • [Feature Group] Site Performance: The issue revolves around the performance of the wp-admin interface, which is significantly slowed down due to JITM requests.
  • [Feature] JITM: The problem is specifically related to Just In Time Messages (JITMs) that are causing delays in page load times.
  • [Feature] Plugins: The issue mentions Jetpack Boost as a plugin involved in the slow performance, indicating that it may be related to plugin functionality affecting load times.

@inaikem
Copy link
Contributor

inaikem commented Dec 2, 2024

Greetings! 👋 I've bumped this for Groundskeeping review: p1733117313873469-slack-C07GZ2UA3TN

@okmttdhr okmttdhr moved this from Needs Triage to In Triage in Automattic Prioritization: The One Board ™ Dec 2, 2024
@okmttdhr okmttdhr self-assigned this Dec 2, 2024
@okmttdhr
Copy link
Member

okmttdhr commented Dec 2, 2024

Hello, @ebinnion! I'd appreciate it if I could get permission for eric.blog to debug.

Here’s what I’ve observed so far:

  • While the request is not from Jetpack Boost, I was able to reproduce the issue on an Atomic site with a custom domain. The JITM request for calypso:sites:sidebar_notice takes approximately 2–3 seconds in my testing.
    • Image
    • When I dismissed the domain upsell in the above image, it became fast again (it took 0.2s or so).
  • The performance on a fresh Atomic site without a custom domain felt faster, with the same JITM request completing in under 0.5 seconds.

This issue likely affects some users, but the specific conditions under which it occurs are still unclear. I’ll continue to investigate further and share updates. CC: @inaikem

@okmttdhr
Copy link
Member

okmttdhr commented Dec 2, 2024

I haven't tracked down the source of the issue. My understanding is that JITMs previously loaded after the initial page load, so I'm not sure what exactly changed.

A possible cause might be related to here: https://github.com/Automattic/jetpack/blob/d407cbc66521be25197ae815463cf614cf0a99de/projects/packages/jetpack-mu-wpcom/src/features/wpcom-sidebar-notice/wpcom-sidebar-notice.php#L39 but I haven't tested it yet.

@wojtekn
Copy link
Contributor

wojtekn commented Dec 2, 2024

It seems there are two things here:

  1. Mentioned request is slow in some cases
    I tried to reproduce it but with no luck. It took 200-300ms to perform this request in my tests.

  2. We abuse the admin_enqueue_scripts action
    This action is supposed to be used to queue scripts and CSS for WP Admin, but in addition to queueing scripts, we synchronously
    request JITM notices.
    It was introduced in the Untangling: Show sidebar notices in WP Admin jetpack#36797 which says we got inspired by the code from nav unification, but this looks like using AJAX request to fetch the JITM.

@ebinnion
Copy link
Contributor Author

ebinnion commented Dec 2, 2024

@okmttdhr - This is harder without my access while on paternity. 😄 I don't have your email and won't want to pass a secret on here. I'll contact support with a username and pass and ask them to pass it on to you.

@essleeung
Copy link

I DM'd @okmttdhr

@okmttdhr
Copy link
Member

okmttdhr commented Dec 3, 2024

  1. We abuse the admin_enqueue_scripts action
    This action is supposed to be used to queue scripts and CSS for WP Admin, but in addition to queueing scripts, we synchronously
    request JITM notices.
    It was introduced in the Untangling: Show sidebar notices in WP Admin jetpack#36797 which says we got inspired by the code from nav unification, but this looks like using AJAX request to fetch the JITM.

I have made Automattic/jetpack#40422 as a potential improvement to address this. Could you take a look at it, @wojtekn?

This is harder without my access while on paternity. 😄 I don't have your email and won't want to pass a secret on here. I'll contact support with a username and pass and ask them to pass it on to you

@\ebinnion @essleeung Thank you both for assisting! I was able to log in to the blog successfully. Unfortunately, I couldn’t reproduce the issue with the provided account, which suggests it might be related to the "1. Mentioned request is slow in some cases" that @wojtekn suggested. This makes the issue a bit trickier to debug.

I’d like to see whether the proposed PR helps mitigate the original issue.

@ebinnion
Copy link
Contributor Author

ebinnion commented Dec 4, 2024

I've tested the PR and left a note about the gain in performance. Thanks for that. I did not actually review any code though.

I have gone ahead and delete my the secret on my site.

@okmttdhr okmttdhr added the Groundskeeping Issues handled through Dotcom Groundskeeping rotations label Dec 4, 2024
@okmttdhr
Copy link
Member

okmttdhr commented Dec 6, 2024

I'll go ahead and close this issue now, as we’ve shipped Automattic/jetpack#40422. Please feel free to reopen this issue if there’s a need to revisit the slow request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Experiment] AI labels added [Feature Group] Site Performance [Feature] JITM Just In Time Messages - pop-up tips and suggestions that appear on the dashboard and sidebar. [Feature] Plugins Features related to plugins on WordPress.com, including search, management, and installation. Groundskeeping Issues handled through Dotcom Groundskeeping rotations Needs triage Ticket needs to be triaged [Platform] Atomic [Pri] High Address as soon as possible after BLOCKER issues [Status] Auto-allocated [Status] Escalated to Product Ambassadors [Type] Bug When a feature is broken and / or not performing as intended
Development

No branches or pull requests

6 participants