为什么要学习 WebAssembly?

ce9159e225dfbb5a17565723f00cc67a.gif

2023 年你有什么学习计划?我计划要学习一门新技术——WebAssembly!

为什么要学习 WebAssembly?

2019 年,Docker 创始人 Solomon Hykes 发布了一条推特在业界引起了轩然大波(见下面的推文),他说如果 2008 年 WebAssembly 和 WASI 就存在的话,他就没必要创建 Docker。一时间,关于 WebAssembly 取代 Docker 的讨论此起彼伏。也是从那时起,WebAssembly 正式进入我的视线。

If WASM+WASI existed in 2008, we wouldn't have needed to created Docker. That's how important it is. Webassembly on the server is the future of computing. A standardized system interface was the missing link. Let's hope WASI is up to the task! https://t.co/wnXQg4kwa4

— Solomon Hykes / @[email protected][1]

(@solomonstre)

March 27, 2019

到了 2021 年,网上突然多了很多关于 WebAssembly 的炒作文章,包括我长期关注的 Istio 也在当年发布的 1.12 版本开始支持 WebAssembly(见 Istio 1.12 引入 Wasm 插件配置 API 用于扩展 Istio 生态[2] ),通过引入 WasmPlugin[3] API,使开发人员更方便扩展服务网格和网关。

最近我看到一篇介绍 WebAssembly 在 2023 年有哪些新趋势的文章[4] ,文章的作者 Matt Butcher 颇有来头,他是 WebAssembly Cloud 公司 Fermyon 的联合创始人和 CEO,也是 Helm、Brigade、CNAB、OAM、Glide 和 Krustlet 的原始创建者之一。通过他的介绍让我笃定,WebAssembly 是一门颇有前景的技术,是时候学习它了。

WebAssembly 的市场前景

更何况 WebAssembly 的应用领域越来越广,像 WasmEdge[5] 这样的公司正在使用 Tensorflow 来突破可以使用 Wasm 运行的边界。Fermyon[6] 正在构建用于微服务的 WebAssembly 工具,而 Vercel[7] 、Fastly[8] 、Shopify[9] 和 Cloudflare[10] 使用 WebAssembly 在边缘运行代码。Figma[11] (2022 年以 200 亿美元被 Adobe 公司收购)正在使用 WebAssembly 为其应用程序在浏览器中提供更高的性能,而他们的新母公司 Adobe[12] 正在使用 WebAssembly 将他们的桌面应用程序带到 Web。

如何学习 WebAssembly?

为了学习 WebAssembly,我制定了以下学习目标:

  1. 1. 了解 WebAssembly 的基本概念,包括它是什么、为什么要使用它、如何在浏览器中运行它;

  2. 2. 学习 WebAssembly 的语言,这是一种类似于汇编语言的低级语言,可以编译成二进制文件;

  3. 3. 使用工具将代码编译成 WebAssembly 格式;

  4. 4. 在 JavaScript 中调用 WebAssembly 模块;

  5. 5. 学习 WebAssembly 的其他特性,如内存管理、多线程和 WebAssembly System Interface(WASI);

  6. 6. 了解 WebAssembly 如何增强安全防护;

  7. 7. 学习 WebAssembly 的最佳实践,如代码优化和调试;

  8. 8. 在 Istio 中开发 WebAssembly 插件;

  9. 9. 学习使用 WebAssembly 开发的开源项目;

WebAssembly 参考资料

下面列出了一些有助于学习 WebAssembly 的参考资料,包括网站和图书:

  • • WebAssembly 官网[13]

  • • WebAssembly 教程[14]

  • • WebAssembly 在线编译器[15]

  • • WebAssembly 学习资源[16]

  • • 《WebAssembly:权威指南:安全、快速和可移植的代码,第 1 版,2022 年 1 月》[17]

  • • wazero: the zero dependency WebAssembly runtime for Go developers[18]

总结

WebAssembly 不仅是用于浏览器端有效弥补 JavaScript 缺陷的一门技术,凭借它的小巧、高效和可移植性在后端也会有很广泛的应用。2023 年,让我们一起来学习 WebAssembly 吧!我也会适时得在云原生社区中创建 Wasm 学习小组,欢迎大家加入云原生社区[19] 共同交流学习。

参考

  • • Istio 1.12 引入 Wasm 插件配置 API 用于扩展 Istio 生态 - cloudnative.to[20]

  • • 在 Istio 中引入 Wasm 意味着什么?- cloudnative.to[21]

  • • 2023 年 WebAssembly 技术五大趋势预测 - cloudnative.to[22]

引用链接

[1] [email protected]mailto:[email protected]
[2] Istio 1.12 引入 Wasm 插件配置 API 用于扩展 Istio 生态: https://cloudnative.to/blog/istio-wasm-extensions-and-ecosystem/
[3] WasmPlugin: https://istio.io/latest/docs/reference/config/proxy_extensions/wasm-plugin/
[4] 文章: https://cloudnative.to/blog/webassembly-5-predictions-for-2023/
[5] WasmEdge: https://wasmedge.org/
[6] Fermyon: https://www.fermyon.com/
[7] Vercel: https://vercel.com/docs/concepts/functions/edge-functions/wasm
[8] Fastly: https://docs.fastly.com/products/compute-at-edge
[9] Shopify: https://shopify.engineering/shopify-webassembly
[10] Cloudflare: https://developers.cloudflare.com/workers/platform/languages/
[11] Figma: https://www.figma.com/blog/webassembly-cut-figmas-load-time-by-3x/
[12] Adobe: https://web.dev/ps-on-the-web/
[13] WebAssembly 官网: https://webassembly.org/
[14] WebAssembly 教程: https://developer.mozilla.org/zh-CN/docs/WebAssembly
[15] WebAssembly 在线编译器: https://wasdk.github.io/WasmFiddle/
[16] WebAssembly 学习资源: https://webassembly.org/getting-started/developers-guide/
[17] 《WebAssembly:权威指南:安全、快速和可移植的代码,第 1 版,2022 年 1 月》: https://www.amazon.com/WebAssembly-Definitive-Guide-Safe-Portable/dp/1492089842/
[18] wazero: the zero dependency WebAssembly runtime for Go developers: https://wazero.io/
[19] 加入云原生社区: https://cloudnative.to/community/join/
[20] Istio 1.12 引入 Wasm 插件配置 API 用于扩展 Istio 生态 - cloudnative.to: https://cloudnative.to/blog/istio-wasm-extensions-and-ecosystem/
[21] 在 Istio 中引入 Wasm 意味着什么?- cloudnative.to: https://cloudnative.to/blog/importance-of-wasm-in-istio/
[22] 2023 年 WebAssembly 技术五大趋势预测 - cloudnative.to: https://cloudnative.to/blog/webassembly-5-predictions-for-2023/

获取更多云原生社区资讯,加入微信群,请加入云原生社区,点击阅读原文了解更多。

Guess you like

Origin blog.csdn.net/weixin_38754564/article/details/128859669