The JIT compilation to WebAssembly they are doing with WebVM is pretty cool!
I didn't see any benchmarks on the linked to page. I tried their sample Fibonacci program, but up to 100000 and ONLY timing actual execution (using the time Python module) to not include startup time, and WebVM only took 6.7 times as long as native for me. That's very impressive.
There's a similar open source project called https://copy.sh/v86/. Using their arch Linux image with the exact same Fibonacci benchmark, it take 44 times as long as native.
I'd love to try v8 there, so we can benchmark the WebVM v8 against the Native JS in the browser... all using the same engine (is a bit meta, isn't it?)
I timed a very simple loop in C: "for (volatile int i=0; i<N; i++);" (handful of arithmetic, compare and branch instructions) with N=1e9 and it was 70% the speed of native which looks really good.
I'd love to see LINPACK now :)
Thanks for the benchmarks! I was curious about timing.
Python is also a bit tricky because it does things with pointers that I believe are hard to optimize (or maybe not, who knows!). Have you tried other languages/programs?
Is WebVM a potential solution to "JupyterLite doesn't have a bash/zsh shell"? The current pyodide CPython Jupyter kernel takes like ~25s to start at present, and can load Python packages precompiled to WASM or unmodified Python packages with micropip: https://pyodide.org/en/latest/usage/loading-packages.html#lo...
Does WebVM solve for workload transparency, CPU overutilization by one tab, or end-to-end code signing maybe with W3C ld-proofs and whichever future-proof signature algorithm with a URL?
The VM cannot have full TCP/IP stack, so any data research tasks are likely to need a special code paths and support for downloads. No SQL databases, etc.
This is awesome. Really. Props to all the Leaning Tech team (creators of Cheerp, an alternative to Emscripten)!
I believe it will be possible to achieve similar state in the future just using Native Wasm/WASI (so no transpilation from x86 -> Wasm will be needed), but we are far from it given how slow the WASI standards move.
The shell is impressive: https://webvm.io/ (only downloads ~5Mb of resources for a full Debian distro)
Assuming they wrote their own xterm interface (no idea if they did, I got as far as that), seems everything open-source is fetched by the client at runtime. This feels to me more like a bootloader than an OS. Not sure where that lands it license-wise whether merely linking to the image requires appropriate licensing and attribution but either way the work seems pretty straightforward to replicate assuming you have / can supply an xterminal-esque interface and can compile your OS image appropriately.
I don't think they're doing anything wrong licensing-wise but I guess it depends on how the law defines including software as a library, whether that needs to happen at compile time or run time, or whatever. Seems like a grey area?
Hey dude, I've been screwing around implementing plan9 semantics in a OS like system for the browser (https://github.com/intigos/possimpible). I'm interested in using a x86 emulator inside a webwoker that I'm using for processes so I can run x86 code. How hard is something like this? Can you give me some pointers on how to start working on this? Thanks!
It seems to not work with my eager block settings. It works with a fresh Firefox profile though, so it's not clear what the issue exactly is though. I know for sure that the ext2 is never actually downloaded (0 byte response) and when I try to check anything in DevTools cxcore.wasm triggers a pause on debugger statement, which spikes the CPU.
Any chance there could be a version with all the assets in one thing (say, GitHub Pages)?
Is there support for loopback networking (for IPC)? Is there a way to translate HTTP(S) requests to `fetch` requests? How difficult would it be to port a Go app that uses https://github.com/pion/webrtc to use the browser's native WebRTC?
What performance bottlenecks are there that can still be improved?
Right now I see a ~6x slowdown on small-code benchmarks like sieve, but it goes up to 50x or more for large code like GCC. For QEMU it's roughly 1.6x and 2-3x respectively, so it seems like your JIT is slower than QEMU's.
> HTTP servers (microservices): By combining Service Workers with virtualized TCP sockets, we will allow HTTP servers inside the WebVM to be reachable from the browser itself. A JavaScript API will be exposed allowing to connect an iframe to the internal servers. This is mostly supported already, although not exposed on the current demo page. A similar solution could be used to support REST microservices as well since Service Workers also handle fetch/XHR requests.
I wonder if this can be used to create a semi-decentralized website where visitors automatically served a vm to run, turning them into an edge server to offload requests from other visitors. The more active visitors, the more edge servers you have. Infinite scaling on the cheap! The visitors may not like you abusing their browser though, but there might be use case where this is acceptable, such as popular community run websites that too expensive to run due to huge amount of traffic.
This would actually be super useful on Chromebook just as an alternative ssh client as I’m not super happy with existing ssh client solutions on Chromebook— especially that chrome ssh extension thingy which sucks pretty hard imo.
Note I don’t like to put my Chromebooks in developer mode or do the crouton stuff or whatever the latest is on that front..
EDIT, nm it has no tcp stack or outbound connectivity
Truly an impressive feat, and a lot of work no doubt. But why? Recently it seems to be some kind of fad to demonstrate that everything can be done inside a web browser. Again: why? Scope creep of web browsers is already beyond repair.
For educational uses, I have plenty of use cases for large scale teaching and learning, without backend servers and without installing anything complex on the client side.
Gotta love the term serverless...on par with fullstack developer.
It's either a server somewhere handling tasks in a queue or the client is the server. I hate that we have to care so much about "words" but I've seen far too many walking away with an impression that the server is unimportant or requires little maintenance in this model. I'd argue it becomes even more important because of how persistence, consensus, availability, etc works /rant
That being said, always excited to see work coming out of webassembly. Network is the computer
Wouldn’t this mean you can host a website in the browser if you run dynamic DNS to connect back to a webserver you have running in the vm on localhost?
It's not really a server but you can do some interesting stuff with intercepting fetches in Service Workers, e.g. https://servefolder.dev - a little side project of mine.
[+] [-] williamstein|4 years ago|reply
I didn't see any benchmarks on the linked to page. I tried their sample Fibonacci program, but up to 100000 and ONLY timing actual execution (using the time Python module) to not include startup time, and WebVM only took 6.7 times as long as native for me. That's very impressive.
There's a similar open source project called https://copy.sh/v86/. Using their arch Linux image with the exact same Fibonacci benchmark, it take 44 times as long as native.
[+] [-] Recursing|4 years ago|reply
It's about ~10x faster on webvm.io compared to copy.sh/v86 and only ~20x slower than native, impressive stuff
[+] [-] syrusakbary|4 years ago|reply
I'd love to try v8 there, so we can benchmark the WebVM v8 against the Native JS in the browser... all using the same engine (is a bit meta, isn't it?)
[+] [-] benou|4 years ago|reply
[+] [-] syrusakbary|4 years ago|reply
Python is also a bit tricky because it does things with pointers that I believe are hard to optimize (or maybe not, who knows!). Have you tried other languages/programs?
[+] [-] westurner|4 years ago|reply
Does WebVM solve for workload transparency, CPU overutilization by one tab, or end-to-end code signing maybe with W3C ld-proofs and whichever future-proof signature algorithm with a URL?
[+] [-] miohtama|4 years ago|reply
[+] [-] mahoro|4 years ago|reply
Now we could create a /dev/dom virtual device, and write dynamic web pages in pure bash. I love this.
[+] [-] colejohnson66|4 years ago|reply
[+] [-] unknown|4 years ago|reply
[deleted]
[+] [-] syrusakbary|4 years ago|reply
I believe it will be possible to achieve similar state in the future just using Native Wasm/WASI (so no transpilation from x86 -> Wasm will be needed), but we are far from it given how slow the WASI standards move.
The shell is impressive: https://webvm.io/ (only downloads ~5Mb of resources for a full Debian distro)
[+] [-] iFire|4 years ago|reply
> Copyright (c) Leaning Technologies Limited. All rights reserved.
https://github.com/leaningtech/webvm/commit/6efab7e60bf6f173...
[+] [-] parksy|4 years ago|reply
Assuming they wrote their own xterm interface (no idea if they did, I got as far as that), seems everything open-source is fetched by the client at runtime. This feels to me more like a bootloader than an OS. Not sure where that lands it license-wise whether merely linking to the image requires appropriate licensing and attribution but either way the work seems pretty straightforward to replicate assuming you have / can supply an xterminal-esque interface and can compile your OS image appropriately.
I don't think they're doing anything wrong licensing-wise but I guess it depends on how the law defines including software as a library, whether that needs to happen at compile time or run time, or whatever. Seems like a grey area?
[+] [-] apignotti|4 years ago|reply
[+] [-] brian_herman|4 years ago|reply
[+] [-] Klasiaster|4 years ago|reply
[+] [-] arturventura|4 years ago|reply
[+] [-] btdmaster|4 years ago|reply
Any chance there could be a version with all the assets in one thing (say, GitHub Pages)?
[+] [-] easrng|4 years ago|reply
[+] [-] bonzini|4 years ago|reply
Right now I see a ~6x slowdown on small-code benchmarks like sieve, but it goes up to 50x or more for large code like GCC. For QEMU it's roughly 1.6x and 2-3x respectively, so it seems like your JIT is slower than QEMU's.
[+] [-] PeterisP|4 years ago|reply
In essence, for this approach, would the x86-on-x86 performance hit be similar or very different than the x86-on-ARM performance hit?
[+] [-] xmly|4 years ago|reply
[+] [-] remisharrock|4 years ago|reply
[+] [-] thekozmo|4 years ago|reply
[+] [-] habitue|4 years ago|reply
[+] [-] unknown|4 years ago|reply
[deleted]
[+] [-] neurostimulant|4 years ago|reply
I wonder if this can be used to create a semi-decentralized website where visitors automatically served a vm to run, turning them into an edge server to offload requests from other visitors. The more active visitors, the more edge servers you have. Infinite scaling on the cheap! The visitors may not like you abusing their browser though, but there might be use case where this is acceptable, such as popular community run websites that too expensive to run due to huge amount of traffic.
[+] [-] raggi|4 years ago|reply
Is there anywhere that documents the covered/uncovered syscall surface?
[+] [-] zekrioca|4 years ago|reply
[+] [-] didip|4 years ago|reply
[+] [-] mrtesthah|4 years ago|reply
[+] [-] indigodaddy|4 years ago|reply
Note I don’t like to put my Chromebooks in developer mode or do the crouton stuff or whatever the latest is on that front..
EDIT, nm it has no tcp stack or outbound connectivity
[+] [-] xiphias2|4 years ago|reply
Would it be possible to compile GNU/Linux to WASM as a target platform? What's missing for that?
[+] [-] s5806533|4 years ago|reply
[+] [-] remisharrock|4 years ago|reply
[+] [-] dnautics|4 years ago|reply
[+] [-] 0x138d5|4 years ago|reply
[+] [-] _57jb|4 years ago|reply
It's either a server somewhere handling tasks in a queue or the client is the server. I hate that we have to care so much about "words" but I've seen far too many walking away with an impression that the server is unimportant or requires little maintenance in this model. I'd argue it becomes even more important because of how persistence, consensus, availability, etc works /rant
That being said, always excited to see work coming out of webassembly. Network is the computer
[+] [-] suifbwish|4 years ago|reply
[+] [-] maltenuhn|4 years ago|reply
[+] [-] remisharrock|4 years ago|reply
[+] [-] endisneigh|4 years ago|reply
[+] [-] AshleysBrain|4 years ago|reply
[+] [-] apignotti|4 years ago|reply
If you'd like to access a server from another tab / iframe of the same browser, that's almost possible already, just some UX work would be required.
If you'd like users of the same page (or a separate specialized page) to connect, that could be possible with WebRTC.
If you'd like arbitrary hosts to connect, that would require a server side proxy, there is no client-side only solution that I can see,
[+] [-] tlarkworthy|4 years ago|reply
[+] [-] mrtesthah|4 years ago|reply
https://www.ctrl.blog/entry/opera-unite.html
[+] [-] blueflow|4 years ago|reply
[+] [-] hunterb123|4 years ago|reply
[+] [-] anonymousiam|4 years ago|reply
So probably good for unprivileged non-networking applications.
[+] [-] 5ESS|4 years ago|reply