-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
TiDB in WebAssembly WASI #13236
Comments
That's so cool! In fact, we are very eager to do this, but we notice that it seems golang/wasi is still working in progress, I'm not sure if it's possible at the present stage. |
After a few trials I got tidb compiled to WASI: However, the file is so large I've been unable to run it with any runtime 😅 |
@syrusakbary It seems that we can only run it in PC's browser now, the phone will report out of execution memory: |
maybe we need to fix #13322 at first, to reduce the binary size. |
@syrusakbary I try to write a hello world with golang, and run it with wasmer, but failed, I'm not sure if something is wrong. |
@syrusakbary finally I make it work by a modified wasmer: You can use this code for testing |
Love it! Can you upload the wasm generated file somewhere? |
Also, can you try to run it with Note: you can install |
We debugged this internally, and it might be caused by go/wasi generating an invalid WebAssembly file. Depending on your results on the previous questions we will be able to validate this assumption. What can be causing the issue? A data element has an address that overflow the end of the memory. If that's the case, this could be easily fixed on the go/wasi side (on the compiler from go to WebAssembly WASI). |
The wasm generated file: main.wasm.zip @syrusakbary PTAL |
@syrusakbary I have modified go/wasi and I can run tidb with wasmer(without modify). However, I can't run it with wapm neither in the browser nor in the local shell. |
We just fixed the issue, and now tidb runs properly on the WebAssembly shell 🎉
|
Wow, amazing job. Thank you @syrusakbary |
@syrusakbary What version the WebAssembly shell will use? There are some bugs in tidb's wasm result and I fixed them, but it seems that the WebAssembly just use an older version in most time (although sometimes it uses newest one) |
Perhaps the module is being cached? |
@lucklove Hello! 😄 So If I could ask, how are you adding the Wasm Module? Are you dragging it in? Or installing it from WAPM? Thanks! 😄 👍 |
@torch2424 I just open WebAssembly Shell and input "tidb" (I think it's installed from WAPM). I expect it uses the newest version, however, it uses old ones. |
Update: I found that it seems webassembly shell store previous downloads in somewhere in the browser so the next time the user input the same command, it doesn't request the network. After clearing cache, it works. |
Ah yep! Sorry for not responding earlier, currently on a work trip! Ah yep, that's a bug, I'll go ahead and open an issue for this, thank you! 😄 👍 Edit: Opened this issue: wasmerio/webassembly.sh#69 |
Closing this since TiDB can work well with WASI now. |
Feature Request
Describe the feature you'd like:
Following #13069, I think it would be a great idea to compile TiDB to WebAssembly WASI.
This way, there can be a standalone TiDB wasm binary published in WAPM and available in any platform/OS and even online with the WebAssembly shell, so anyone can play with it easily.
Describe alternatives you've considered:
This should be feasible by using the go/wasi implementation.
Teachability, Documentation, Adoption, Migration Strategy:
If this is something that you are interested in, we can help on the implementation :)
The text was updated successfully, but these errors were encountered: