-
Notifications
You must be signed in to change notification settings - Fork 54
Studio: Improve performance for create site #1840
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
Conversation
This reverts commit a0145e8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great refactor. I reviewed the code, and suggested a few improvement on Blueprint types. I also tested the app and only found these errors:
- The Stop all button on the left sidebar doesn't work.
- The creation site notification appears too early and not after the site is created.
- I tested it on Windows using Parallels and it took a while to create the site and it render the wp-admin.
windows-slow.mp4
src/lib/wordpress-provider/playground-cli/playground-cli-provider.ts
Outdated
Show resolved
Hide resolved
src/lib/wordpress-provider/playground-cli/playground-cli-provider.ts
Outdated
Show resolved
Hide resolved
sejas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bcotrim , thanks for applying the suggestions.
I tested the app on Mac and WIndows and I didn't catch any regression. I was able to create a site using a local blueprint and also a blank site.
Windows is still slower than Mac, but the problem seems to come from the playground-cli boot process.
Here are the logs for both platforms:
MAC
Would have bumped stat: studio-app-site-create=file-blueprint
Starting server for 'blue git'
[playground-cli] [+10.81ms | Total: 10.81ms] The fs-ext package is not installed. Internal file locking will not be integrated with host OS file locking.
[playground-cli] [+0.90ms | Total: 11.71ms] Starting a PHP server...
[playground-cli] [+5.48ms | Total: 17.19ms] Setting up WordPress latest
[playground-cli] [+698.12ms | Total: 715.30ms] Resolved WordPress release URL: https://downloads.w.org/release/wordpress-6.8.3.zip
[playground-cli] [+8.96ms | Total: 724.27ms] Fetching SQLite integration plugin...
[playground-cli] [+1.01ms | Total: 725.28ms] Booting WordPress...
PHP.request() is deprecated. Please use new PHPRequestHandler() instead.
[playground-cli] [+4374.35ms | Total: 5099.63ms] Booted!
[playground-cli] [+0.62ms | Total: 5100.25ms] Running the Blueprint...
Logging in – 100%
[playground-cli] [+2957.13ms | Total: 8057.38ms] Finished running the blueprint
[playground-cli] [+0.17ms | Total: 8057.55ms] WordPress is running on http://127.0.0.1:8887 with 1 worker(s)
Server started for 'blue git'
Window Logs
Would have bumped stat: studio-app-site-create=no-blueprint
Starting server for 'windows blank site'
[playground-cli] [+29.98ms | Total: 29.98ms] Starting a PHP server...
[playground-cli] [+35.95ms | Total: 65.93ms] Setting up WordPress latest
[playground-cli] [+1412.18ms | Total: 1478.11ms] Resolved WordPress release URL: https://downloads.w.org/release/wordpress-6.8.3.zip
[playground-cli] [+104.38ms | Total: 1582.49ms] Fetching SQLite integration plugin...
[playground-cli] [+5.21ms | Total: 1587.69ms] Booting WordPress...
PHP.request() is deprecated. Please use new PHPRequestHandler() instead.
[playground-cli] [+60377.93ms | Total: 61965.63ms] Booted!
[playground-cli] [+6.61ms | Total: 61972.24ms] Running the Blueprint...
Running the Blueprint ΓÇô 0%
Running the Blueprint ΓÇô 1%
Running the Blueprint ΓÇô 33%
Running the Blueprint ΓÇô 34%
Running the Blueprint ΓÇô 35%
Running the Blueprint ΓÇô 36%
Running the Blueprint ΓÇô 37%
Running the Blueprint ΓÇô 38%
Running the Blueprint ΓÇô 39%
Running the Blueprint ΓÇô 40%
Running the Blueprint ΓÇô 41%
Running the Blueprint ΓÇô 42%
Running the Blueprint ΓÇô 43%
Running the Blueprint ΓÇô 44%
Running the Blueprint ΓÇô 45%
Running the Blueprint ΓÇô 46%
Running the Blueprint ΓÇô 47%
Running the Blueprint ΓÇô 48%
Running the Blueprint ΓÇô 49%
Running the Blueprint ΓÇô 50%
Running the Blueprint ΓÇô 51%
Running the Blueprint ΓÇô 52%
Running the Blueprint ΓÇô 53%
Running the Blueprint ΓÇô 54%
Running the Blueprint ΓÇô 55%
Running the Blueprint ΓÇô 56%
Running the Blueprint ΓÇô 57%
Running the Blueprint ΓÇô 58%
Running the Blueprint ΓÇô 59%
Running the Blueprint ΓÇô 60%
Running the Blueprint ΓÇô 61%
Running the Blueprint ΓÇô 62%
Running the Blueprint ΓÇô 63%
Running the Blueprint ΓÇô 64%
Running the Blueprint ΓÇô 65%
Running the Blueprint ΓÇô 66%
Logging in ΓÇô 66%
Logging in ΓÇô 100%
[playground-cli] [+4578.10ms | Total: 66550.34ms] Finished running the blueprint
[playground-cli] [+3.50ms | Total: 66553.85ms] WordPress is running on http://127.0.0.1:8892 with 1 worker(s)
Server started for 'windows blank site'
-13536-cNMUjMeNvJEY
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-14560--14560-Xnz3PrPc4Mif
-13536-cNMUjMeNvJEY
-13536-cNMUjMeNvJEY
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-14560--14560-Xnz3PrPc4Mif
-13536-cNMUjMeNvJEY
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-14560--14560-Xnz3PrPc4Mif
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-8832--8832-WxdxW0O4mj9b
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-17108--17108-SNpZ3zooZ0oC
-13536-cNMUjMeNvJEY
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-14560--14560-Xnz3PrPc4Mif
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-8832--8832-WxdxW0O4mj9b
-13536-cNMUjMeNvJEY
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-14560--14560-Xnz3PrPc4Mif
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-8832--8832-WxdxW0O4mj9b
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-17108--17108-SNpZ3zooZ0oC
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-15180--15180-G00mNJ9sszRQ
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-3480--3480-U9vpYFPwpJQ5
Deleted stale Playground temp dir: C:\Users\MACBOO~1\AppData\Local\Temp\electron.exe-playground-cli-site-4064--4064-aKbQlfpJhYgE
src/lib/wordpress-provider/playground-cli/playground-server-process-child.ts
Outdated
Show resolved
Hide resolved
|
This definitely improved performance, you can see it on Code vitals on the site creation metric https://www.codevitals.run/project/studio/siteCreation We're now back to similar performance levels to pre playwright CLI enabling. |
|
Thanks for checking and sharing @youknowriad - introducing those performance tests was a good idea! |
|
haha thanks, let's keep an eye on them. They're only useful if we pay attention to them though :P |
|
Really nice work here! 🎉 A few thoughts I had about Mac logs: This time is mostly spent on translating This is the time needed to spawn a worker and run the WordPress installation wizard. We could likely cache a vanilla WordPress installation to save a bit time here, although we'd pay the price in complexity. Starting a new site from that "preinstalled template" would require rewriting URLs and likely other database records – https://playground.wordpress.net/ used to do that and it was faster, but it was also error-prone. Now we just run the installation wizard every time until we have a full site importing pipeline. Not sure what's in the Blueprint but 3 seconds seems pretty cool. I'm happy to discuss any perf improvements here if you think there's a room for that. |
|
About the windows logs – this is such a long, looong time. Is this with the windows security layer exception added to prevent it from slowing down the process? |
I have the Windows security layer exception and noticed similar times. Disabling the Windows security also didn't help, from my testing. |
Related issues
Proposed Changes
createSitestore setup steps in a blueprint to run at first site start. This will avoid having to run Playground CLI twice (once forrun-blueprintand another forserver)startSiteis done.get_theme_detailsendpoint - Retrieves active theme information without loading WordPressset_admin_passwordendpoint - Sets/updates admin user password without loading WordPressrequest()method to Playground CLI server process to communicate with persistent WordPress instance via HTTP requestsphpGetThemeDetailsto support WP-Now provider (usesrunPhp()whenrequest()is not available)Testing Instructions
Pre-merge Checklist