-
Notifications
You must be signed in to change notification settings - Fork 360
PHP.wasm: Explore WASMFS/OPFS #1878
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
Trying to switch to WASMFS and lean on the native OPFS support see emscripten-core/emscripten#15949 Work in progress
ffd7628 to
180ff11
Compare
Concurrent writes to the same OPFS filesystem from multiple browser tabs seem to be an uncharted territory. The browser would need similar synchronization mechanisms as the regular filesystem.
Notion encountered the same problem and ended up using a SharedWorker. This would technically enable us to run multiple Playground workers for the same site, but it would introduce a shared bottleneck in form of that SharedWorker. The entire premise of running, say, 5 concurrent PHP workers would be to parallelize the computations and handle concurrent requests independently using some form of round-robin across all the running workers.
WebKit seems to be against JSPI, but with this JSPI as a library prototype perhaps we could polyfill it. The description makes me concerned about the performance but we can only know for sure if we try it.
Uh oh!
There was an error while loading. Please reload this page.
Exploring a switch to WASMFS and lean on the native OPFS support.
See:
This is not viable today. Let's keep revisiting it every six months.
This work leans on JSPI. I don't see a way of adopting WASMFS with OPFS backend without maintaining two very different PHP.wasm releases until JSPI is widely supported.
Why OPFS?
If this worked AND it has decent support for locks (SQLite-wise), we could:
Why WASMFS?
If we only got WASMFS to work without the OPFS backend, we could:
Technical limitations