Skip to content

Improve local wp-admin responsiveness#3377

Open
chubes4 wants to merge 2 commits into
trunkfrom
test/dashboard-update-checks
Open

Improve local wp-admin responsiveness#3377
chubes4 wants to merge 2 commits into
trunkfrom
test/dashboard-update-checks

Conversation

@chubes4
Copy link
Copy Markdown
Contributor

@chubes4 chubes4 commented May 7, 2026

Summary

  • Add a small in-memory background task scheduler for best-effort Studio maintenance tasks with dedupe, delay, cancellation, running-state guards, and serialized concurrency groups.
  • Move local admin health/update/translation checks off passive wp-admin requests and refresh them shortly after site create/start.
  • Route thumbnail capture through the scheduler as the first existing caller, preserving per-site dedupe and global capture serialization.

Fixes #3367

Performance evidence

The main bottleneck found was fresh/passive wp-admin requests blocking on opportunistic WordPress.org checks. Explicit update/install/plugin/theme pages are intentionally excluded so user-requested live data still loads normally.

Dashboard/request-profiler baseline:

  • /wp-admin/ PHP request: ~1608 ms
  • curl total: ~2.24 s
  • outbound WordPress.org calls: 5
  • artifact: /var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/studio-dashboard-profile-baseline-jipGCw/summary.json

Dashboard after scoped deferral:

  • /wp-admin/ PHP request: ~149 ms
  • curl total: ~0.76 s
  • outbound dashboard HTTP: 0
  • artifact: /var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/studio-dashboard-profile-dashboard-scoped-8XmOjZ/summary.json

Broad admin cold-page probe:

  • posts: 1.72 s -> 0.93 s
  • ordinary content/settings pages stayed around 0.64-0.92 s
  • explicit pages such as plugins.php and plugin-install.php still perform their live checks by design
  • baseline artifact: /var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/studio-broad-admin-broad-admin-normal-normal-ibRqqe/summary.json
  • patched artifact: /var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/studio-broad-admin-broad-admin-passive-defer-normal-bQmeEq/summary.json

Site Editor A/B:

  • baseline measure_site_editor_ready_ms: 1113, 1141, 1304; median 1141 ms
  • patched measure_site_editor_ready_ms: 1120, 1210, 1226; median 1210 ms
  • conclusion: neutral/no meaningful Site Editor improvement; this PR should not be treated as improving the site-editor.load metric
  • baseline artifact: /var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/studio-site-editor-ab-baseline-i7b9XP/summary.json
  • patched artifact: /var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/studio-site-editor-ab-patched-o5YpgM/summary.json

WooCommerce probe:

  • this does not solve WooCommerce-specific admin slowness
  • Woo remains a separate path involving onboarding redirects, Woo Admin runtime, Woo/WP.com API work, and Action Scheduler async loopbacks

Diagnostic tooling used:

Testing

  • npm run test -- --project common -- tools/common/lib/tests/mu-plugins.test.ts
  • npm run test -- --project studio -- apps/studio/src/lib/tests/site-maintenance-tasks.test.ts apps/studio/src/lib/tests/background-tasks.test.ts apps/studio/src/lib/tests/capture-site-thumbnail.test.ts apps/studio/src/modules/cli/lib/tests/cli-events-subscriber.test.ts
  • npm -w studio-app run typecheck
  • npm -w studio-app run lint

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (GPT-5.5)
  • Used for: Profiling local wp-admin performance, drafting the background task scheduler and MU-plugin changes, writing regression tests, and assembling the evidence above. Chris reviewed the direction and requested the PR evidence/framing.

@wpmobilebot
Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing f38397b vs trunk

app-size

Metric trunk f38397b Diff Change
App Size (Mac) 1410.38 MB 1410.41 MB +0.04 MB ⚪ 0.0%

site-editor

Metric trunk f38397b Diff Change
load 1515 ms 1523 ms +8 ms ⚪ 0.0%

site-startup

Metric trunk f38397b Diff Change
siteCreation 8086 ms 8079 ms 7 ms ⚪ 0.0%
siteStartup 4932 ms 4948 ms +16 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@chubes4
Copy link
Copy Markdown
Contributor Author

chubes4 commented May 8, 2026

@fredrikekelund What do you think of this approach for wp-admin performance?

The idea is to keep passive wp-admin requests from blocking on opportunistic WordPress.org checks, while preserving the normal behavior on explicit update-related pages like Plugins, Themes, Updates, and Add Plugins.

I added a small background-tasks.ts abstraction so Studio has one place for delayed/deduped best-effort work. This lets Studio refresh those checks shortly after site creation/startup, outside the user’s dashboard request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fresh local dashboard blocks on WordPress.org checks

2 participants