雲原生的下一步,或從WebAssembly在邊緣取代Docker開始

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"過去幾年,雲計算的邊界不斷向邊緣側延伸。作爲雲原生技術事實標準的Kubernetes+容器組合,自然也被很多人考慮部署到邊緣側,以提高邊緣應用部署的效率和便利性,降低邊緣應用與硬件之間的耦合度。不過Kubernetes+容器組合並非萬用良藥,對於邊緣計算場景來說,它們還是太重了。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"邊緣設備通常硬件資源有限,沒有足夠的資源部署運行完整的Kubernetes。其他問題還有:很多邊緣設備基於ARM架構,但大部分Kubernetes發行版不支持ARM架構;邊緣設備所處環境複雜,無法保證穩定可靠的網絡連接,而Kubernetes不支持離線運行,等等。爲了解決包含但不限於以上Kubernetes在邊緣計算場景下的挑戰,更好地將Kubernetes從雲端延伸到邊緣,業內已經誕生了多個基於原生Kubernetes優化的開源項目,比如華爲開源的KubeEdge、阿里開源的OpenYurt、騰訊開源的SuperEdge、Rancher開源的K3s等,並且這四個項目都已經被雲原生計算基金會(下文簡稱CNCF)接收。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"而傳統容器方案比如Docker,問題與Kubernetes類似,它還是一個相對重的容器運行時,鏡像大小很容易就達到一兩百MB以上,對於資源不足的硬件——邊緣場景有不少內存和磁盤空間小於1GB的微型設備,Docker也不是一個理想的選擇。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"邊緣計算不僅需要更輕量的Kubernetes,也需要更輕量、更快的容器方案,WebAssembly就是近幾年出現的一個新選擇。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2021年,"},{"type":"link","attrs":{"href":"https:\/\/mp.weixin.qq.com\/s\/755K7xH6pCANB-NMLCZq0Q","title":null,"type":null},"content":[{"type":"text","text":"雲原生社區"}]},{"type":"text","text":"對WebAssembly的興趣愈發濃厚,WebAssembly在雲原生方向也十分活躍。到目前爲止,CNCF已經正式接收了至少三個WebAssembly項目,包括:"},{"type":"link","attrs":{"href":"https:\/\/github.com\/WasmEdge\/WasmEdge","title":null,"type":null},"content":[{"type":"text","text":"WasmEdge"}]},{"type":"text","text":"Runtime,一個雲原生WebAssembly runtime;"},{"type":"link","attrs":{"href":"https:\/\/github.com\/wasmCloud\/wasmCloud","title":null,"type":null},"content":[{"type":"text","text":"wasmCloud"}]},{"type":"text","text":",一個WebAssembly應用程序框架;"},{"type":"link","attrs":{"href":"https:\/\/github.com\/krustlet\/krustlet","title":null,"type":null},"content":[{"type":"text","text":"Krustlet"}]},{"type":"text","text":",一個在Kubernetes pods中運行WebAssembly程序的工具。其中,WasmEdge和Kruslet通過兩種不同的方式,做到了讓Kubernetes集羣中的WebAssembly 工作負載可以與傳統容器(例如containerd、Docker和CRI-O)並列運行,用戶可以使用與管理Docker應用程序完全相同的工具來管理WebAssembly應用程序。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"而說到WebAssembly最初與Docker、雲原生產生關聯,就不得不提Docker聯合創始人Solomon Hykes在2019年3月份發佈的一條"},{"type":"link","attrs":{"href":"https:\/\/twitter.com\/solomonstre\/status\/1111004913222324225","title":null,"type":null},"content":[{"type":"text","text":"推文"}]},{"type":"text","text":"。他在推文中表示:如果WASM(WebAssembly)和 WASI(WebAssembly System Interface, WASM 系統接口)在2008年就已經存在,那就沒有必要創建Docker了。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/18\/18c98a2e45f5df47acb34975f8dd12d2.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這條推文在社區裏引起了很大的反響,有贊同者,但更多的是質疑:WebAssembly這個發源於瀏覽器的東西,怎麼突然就能在服務端取代Docker了呢?隨後Solomon又發佈了一條推文解釋道:WebAssembly不會取代Docker,但是可以想象未來WebAssembly應用容器將與Linux容器、Windows容器在Docker中並列運行。如今,Solomon說的未來已經成爲現實,只不過他原話中的Docker替換成Kubernetes更準確。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/8e\/8e346750e61cfa48a5a27e86e44108c9.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/github.com\/containers\/crun","title":null,"type":null},"content":[{"type":"text","text":"Crun"}]},{"type":"text","text":"是 Kubernetes 社區裏最流行的容器運行與管理工具,由紅帽軟件發起,一開始只支持基於 Linux 的應用容器。但最近crun項目已經正式支持 WasmEdge,能同時運行與管理 WasmEdge容器鏡像與 Linux 容器鏡像。通過crun的底層支持,目前WebAssembly已經融入到了整個 Kubernetes 生態中,開發者可以使用 Kubernetes、Containerd、CRIO 、Docker Hub來管理 WebAssembly 鏡像。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"那麼,WebAssembly是如何從前端走向後端的?WasmEdge在其中扮演什麼樣的角色?未來在龐大的雲原生生態中,WebAssembly又會佔據什麼樣的位置?InfoQ近日有幸專訪了WasmEdge項目創始人Michael Yuan,請他跟我們聊聊他對於WebAssembly的思考,以及WasmEdge的發展歷程和定位。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"WebAssembly從瀏覽器走向雲原生"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Michael有一個雖然可能引發爭論但很有意思的理論,他認爲,後端的技術每隔十年左右總要重新發明一次輪子。1999-2000年Java給後端帶來了革命性的變化,十年後主角換成了JavaScript,原本JavaScript一直是前端語言,但自"},{"type":"link","attrs":{"href":"https:\/\/zh.wikipedia.org\/zh-tw\/Node.js","title":null,"type":null},"content":[{"type":"text","text":"Node.js"}]},{"type":"text","text":"誕生後越來越多人也在後端使用JavaScript了。這背後的邏輯在於,開發者需要一個輕量級且容易理解的技術,但後端類軟件每發展到一定階段之後都會變得相當複雜,這個時候就會有開發者想重造一個複雜度沒那麼高的新輪子出來,每十年左右就會有一個這樣的週期。2019年正好是一個新十年週期的開始,而WebAssembly就是Michael認爲的這一個十年週期的新輪子,在他看來,WebAssembly也會從前端轉移到後端然後把後端革命掉。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"WebAssembly發源於瀏覽器端,最初主要設計來改善JavaScript的Native性能和代碼執行效率。2019年12月5日,WebAssembly經過萬維網聯盟(W3C)推薦,與HTML、CSS和JavaScript一起,成爲了Web的第四種語言。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"關於WebAssembly技術演變過程,可查閱筆者早前策劃的文章:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/www.infoq.cn\/article\/4qgBeSHGipa7A9HAr7DP","title":null,"type":null},"content":[{"type":"text","text":"《WebAssembly 如何演進成爲“瀏覽器第二編程語言”?》"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2021年7月,計算機協會編程語言特別興趣小組將其享有盛譽的"},{"type":"link","attrs":{"href":"https:\/\/www.sigplan.org\/Awards\/Software","title":null,"type":null},"content":[{"type":"text","text":"編程語言軟件獎"}]},{"type":"text","text":"(Programming Language Software Award)頒給了WebAssembly,高度肯定了WebAssembly 作爲“自JavaScript以來第一種在Web瀏覽器中廣泛採用的新語言”的成就。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"不過Michael認爲WebAssembly更大的市場在後端。雖然WebAssembly在瀏覽器裏確實發揮了重要作用,但沒有達到“必要”的程度,“有了最好,但沒有也能用”。WebAssembly在前端完成的最重要也最有意義的一件事情,是在Google、Apple、Mozilla、微軟這樣的大廠和W3C這樣的組織聯合推動下,實現了很好的標準化,這是後來的技術很難去跟WebAssembly競爭的地方。也正因爲已經通過瀏覽器端做好了標準化,WebAssembly纔有可能從前端走向後端,纔可能在後端做更多的事情。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Michael認爲現在WebAssembly想要解決的問題,跟它剛誕生時想要解決的問題是一致的。這個核心問題就是要在一個大型應用程序裏,給開發者提供一個可以寫擴展的機會。一開始是在瀏覽器裏面可以寫應用,這就是對瀏覽器的一種擴展,只是原來只能用JavaScript寫,現在有了一個新方法,可以用C++寫、可以用Rust寫,然後編譯成WebAssembly去運行。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"而今天的WebAssembly應用依然延續着這個想法。比如在邊緣計算場景,或者在SaaS應用場景,都是有一個操作系統或應用程序,以前這個系統外部開發者是進不去的,如果要安全地運行外部開發者提交的代碼,一個方法就是把代碼裝在Docker裏運行。但是Docker又太重了,有了WebAssembly就可以打開一個口子,把任何一個軟件都變成平臺。這也是目前流行的一個大趨勢,即“軟件平臺化”。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"所以WebAssembly除了是一種編程語言,也被視作一個輕量級、快速、安全和多語言的函數“容器”,和Docker屬於不同抽象層次。如何理解?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Michael表示容器相關技術可以分爲三個抽象層次,其中虛擬機是在計算機層面的抽象;應用容器如Docker是在操作系統層面的抽象;WebAssembly則是在操作系統進程層面的抽象,它與JVM、V8都屬於高級語言虛擬機,抽象程度最高。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在一般操作系統上面能幹的事情在Docker裏面都能幹,但WebAssembly不是,它展現出來的是一個執行環境,只能執行編譯好的字節碼應用,不起操作系統的作用。所以它需要的工具鏈最複雜,但相應地也能帶來性能的巨大提升。根據WasmEdge團隊的"},{"type":"link","attrs":{"href":"https:\/\/www.infoq.com\/articles\/arm-vs-x86-cloud-performance","title":null,"type":null},"content":[{"type":"text","text":"測試結果"}]},{"type":"text","text":",在冷啓動上WebAssembly能做到比Docker快100倍;在執行時間上,WebAssembly比Docker快10%-50%。在Docker只作爲執行環境的場景,即把程序寫好了放到Docker裏執行,執行完之後就關閉Docker,沒有用戶互動的情況,就是WebAssembly能夠完全取代Docker的一個應用場景。而邊緣計算裏有大量這樣的場景,這也是WasmEdge這個開源項目瞄定的目標場景。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"藉助WebAssembly這樣的方案,就能在邊緣場景跨平臺地、輕量級地、快速地用雲原生理念和雲原生工具去部署應用程序。Michael表示,Kubernetes+Docker這套方法在邊緣側推進遇到了很大阻力,而WebAssembly是在正確時間出現的一個正確的解決方案。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"WasmEdge的生態定位"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最初決定要做一個WebAssembly方向的開源項目時,Michael和團隊成員就想好了要做WebAssembly Runtime。當時市場上已有的WebAssembly Runtime都有兩個問題。一個問題是都聚焦在瀏覽器場景,其中一個非常突出的例子是谷歌的V8。V8堪稱工程奇蹟,它是一個非常複雜、工程化程度非常高的軟件,內置一個WebAssembly Runtime。但V8是專爲谷歌瀏覽器優化的,它永遠不可能把裏面的WebAssembly單拆出來,而是必須要和JavaScript整套綁在一起,導致體積增加了幾十倍。但瀏覽器需要JavaScript,後端不需要,後端需要的只是WebAssembly這塊,但V8又不會把它單獨拿出來。因此這類Runtime並不能很好地滿足後端的使用需求。另一個問題是,其他的 WebAssembly Runtime 都是標準驅動的,跟隨 WebAssembly 標準,在擴展方面做的不太好。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"由於一開始團隊還不能確定未來具體的應用場景,因此只是想做一個比較輕量級、易擴展、能夠針對各種應用場景優化的開源WebAssembly Runtime。最初在給項目取名字這件事上也比較隨意,直接沿用了創業公司的名字Second State,將開源項目命名爲Second State VM,即SSVM。直到今年項目被CNCF納入托管之前,由於CNCF要求開源項目的名字裏不能有公司的商標,團隊纔開始考慮給項目換個名字。這時候團隊對於這個項目的定位已經有了更清晰的規劃,就是要將它用在應該使用Docker而Docker用不起來的地方,即把雲原生這套理念和工具應用到邊緣計算場景,這也是WasmEdge這個名字的由來。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如今業界已經圍繞WebAssembly構建起了一個非常龐大的生態,Runtime可以說是整個生態中最底層的基礎設施(下圖是以WasmEdge爲例描繪的WebAssembly生態圖)。其中最有代表性的項目包括WasmEdge、V8、Wasmtime、WAMR等,不同Runtime各有各的應用場景和優化點。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/ff\/ffb1541f46d800452a2b9a953e3f4ab4.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Runtime提供了一個運行代碼的地方,但如果每行代碼都要從頭寫的話,對於開發者來說太麻煩了,所以開發者一般會使用框架。在Runtime之上還會有運行這些框架的應用服務器,這樣的應用服務器在 Java 非常常見,比如 WildFly(Jboss)、ColdFusion、Apache Tomcat、Apache TomEES等等,JavaScript 也有 Node.js 與 Deno 兩個應用服務器。WebAssembly 現在已經有了 wasmCloud 與 Suborbital 兩家創業公司,未來勢必將湧現出更多應用服務器。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Runtime之下則是各種各樣的操作系統和硬件架構,每一個WebAssembly Runtime都會支持一些自己認爲比較重要的硬件和操作系統的組合。Runtime的東西向則是編譯器和工具鏈,因爲WebAssembly是字節碼,就需要上游生態的支持,比如要將Rust編譯成WebAssembly,就需要Rust編譯器的支持。由於標準化做得好,目前很多編譯器項目和編程語言的編譯器針對WebAssembly的編譯工具鏈都已經有了很好的支持。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對於當前的WebAssembly生態,還有一個很多人會好奇的問題:我們需要這麼多Runtime嗎?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Michael表示,現在還是需要的,因爲還處在一個百花齊放的階段,最後哪個Runtime能贏還不一定。他認爲,從長期來看,最終Runtime應該會收斂爲2-3個,從分佈式集羣的運維角度考慮,對於很多應用場景,特別是像區塊鏈這樣的場景,還是需要有多個Runtime的。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"“其實現在市場已經收斂得差不多了,能夠數得上號的Runtime基本也就四個:WasmEdge、Wasmtime、Wasmer和WAMR(WebAssembly Micro Runtime)。我覺得肯定還會繼續淘汰,直到剩下最後的2-3個。”"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"當然還有一個可能性,就是未來所有Runtime都把功能做的差不多,大家都趨於標準化了。不過Michael表示,雖然有很多標準化的擴展,但不是每個Runtime都會選擇去做,因爲大家有不同的側重點。還是以V8爲例,現在很多在後端做的擴展,V8就不想做,因爲這些在瀏覽器場景沒有意義,做了這些除了增加潛在Bug以外,沒有什麼其他好處。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"WasmEdge目前的重點是推動WebAssembly更快地整合到後端生態裏面,進而往雲原生和邊緣計算方向走得更遠、更快。前不久,團隊與FutureWei"},{"type":"link","attrs":{"href":"https:\/\/mp.weixin.qq.com\/s\/6Z2oMqtGkj7ThZp0ywFfRA","title":null,"type":null},"content":[{"type":"text","text":"合作"}]},{"type":"text","text":"爲seL4 和 WasmEdge 構建了一個 WebAssembly 管理代理,使WebAssembly 字節碼應用程序能在 seL4 RTOS 上簡單地被部署和執行,這樣一來在如自動駕駛汽車、無人機這樣的邊緣設備上也可以方便地運行應用程序容器。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"此外,如本文開頭所述,crun目前已經合併了"},{"type":"link","attrs":{"href":"https:\/\/wasmedge.org\/book\/en\/kubernetes\/container\/crun.html","title":null,"type":null},"content":[{"type":"text","text":"WasmEdge的貢獻"}]},{"type":"text","text":",在讀取容器鏡像時能夠自動檢測它到底是用於WasmEdge還是containerd\/Docker,然後啓動和管理相應的runtime\/容器,這樣一來WebAssembly就能夠無縫融入現有的K8s生態。而且開發者對此是無感知的,開發者用WebAssembly編寫的應用程序編譯後推到Docker Hub裏面,就能用K8s生態中的工具直接管理了。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這是WasmEdge向邊緣雲原生走出的第一步,接下來團隊會在邊緣場景尋找更多用戶案例,在得到充分驗證之後,再考慮把WebAssembly移到數據中心來取代現有的基礎設施的可能性。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"取代Docker的可能性"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"兩年前,WebAssembly以超乎預料的發展速度闖入大家的視線,一度被視爲"},{"type":"link","attrs":{"href":"https:\/\/www.infoq.cn\/article\/ImyZHFuUpoewipIXttg7","title":null,"type":null},"content":[{"type":"text","text":"Web新技術浪潮的主角"}]},{"type":"text","text":",當時很多人"},{"type":"link","attrs":{"href":"https:\/\/mp.weixin.qq.com\/s?__biz=MjM5MDE0Mjc4MA==&mid=2651023392&idx=4&sn=e394fc4a06284ba3ce2aad8be353ea21&chksm=bdbe90738ac919659a4682c67a7819a4066b6acbd875e7a7e28b2d54a5b60e7474e1bb0f7529&scene=27#wechat_redirect","title":null,"type":null},"content":[{"type":"text","text":"認爲"}]},{"type":"text","text":"2020年會是一個WebAssembly應用百花齊放的年份。但2020年一場突如其來的疫情,讓WebAssembly在很多方面的發展都"},{"type":"link","attrs":{"href":"https:\/\/www.infoq.cn\/article\/3iSb8yy4ibweSAtVAgc3","title":null,"type":null},"content":[{"type":"text","text":"放慢了腳步"}]},{"type":"text","text":",不過社區並沒有停下對新方向的探索和嘗試。2021年,WebAssembly迎來了Web瀏覽器之外的爆炸性增長,尤其是在服務器端和雲原生環境。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Michael認爲,當前WebAssembly正處在一個類似Java在2001-2002年的階段。後端應用剛剛開始,雖然很多人還是會覺得這個東西可以放到後端有些奇怪,但認真研究之後也能認可這個思路是make sense的。大家對於WebAssembly的興趣也非常濃厚,即使不一定有需求,也有很強烈的想法要試試看有什麼辦法可以把WebAssembly用起來。Michael覺得這是一個非常有意思的階段,“生態早期就是這樣,Rust語言一開始也是一樣。就是有事沒事,以前用C++寫的,現在用Rust重寫。社區對這個東西有興趣,然後大家都在找這個東西能有什麼用。”"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在他看來,這是一個行業發展的前奏。早期開發者可能不知道自己的應用場景是什麼,但他就是要用這個技術。如果行業沒有這個過程的話,就不會有人去推動技術向前走,技術其實是起不來的。這也是他看好WebAssembly發展的原因之一,但他同時也坦言,WebAssembly要真正做到應用的爆發、甚至能夠掙到錢,還需要一段時間。“就像在2001-2002年之後又過了幾年,纔開始有圍繞Java的項目賺到錢。”"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"據Michael介紹,自從加入CNCF之後,WasmEdge項目的社區活躍度有了很明顯的提升。相較於在GitHub上有多少顆Star,團隊更看重有多少外部開發者在參與開源項目的貢獻和討論。目前WasmEdge社區中已經有上百個Second State公司以外的開發者給項目提交Issue,貢獻代碼的開發者也有數十人。這其中既有來自華爲、紅帽、微軟、螞蟻集團等大廠的開發者,也有來自如YOMO這樣的創業公司的開發者。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"此外,在社區層面的合作上,現在也已經有很多基於Kubernetes的產品與WasmEdge展開合作,比如Linkerd、KubeEdge、SuperEdge等。同樣是以將雲原生從數據中心延伸到邊緣端爲目標,KubeEdge、SuperEdge與WasmEdge之間其實能形成很好的互補,如果說KubeEdge+Docker是輕量級+重量級的解決方案,那麼KubeEdge+WasmEdge就是輕量級+輕量級的解決方案。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在技術演進上,WasmEdge不是一個標準驅動的項目,這跟同爲WebAssembly Runtime類型的Wasmtime有很大的不同。WasmEdge更多是一個由應用場景驅動的項目,即需求來自於社區夥伴在使用過程中遇到的問題,由社區來指導項目的技術研發方向,因此對於社區交流和互動也會更加看重。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對於WebAssembly在新一年的發展,Michael做了一個相對樂觀的預測。在他看來,WebAssembly將會在邊緣端得到廣泛應用,今天在邊緣很多想用Docker但又用不了的場景,會被WebAssembly給喫掉,尤其是在KubeEdge這樣的框架的加持下。“在邊緣端取得成功之後,它就會像農村包圍城市,重新進到數據中心裏面去。”"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對於WasmEdge,Michael非常希望它能夠使最後成功的2個Runtime中的一個。“說實話,我覺得很大概率最後會是Wasmtime和我們。兩個項目各自聚焦不同的方向,Wastime聚焦於Fastly那套和標準化,我們聚焦於滿足邊緣計算和邊緣設備的需求。”他補充表示,WasmEdge現在是CNCF的項目,而不是Second State的項目,Second State只是爲項目提供了一些開發者。他希望,更多對WebAssembly感興趣的人能夠聚合到WasmEdge項目裏來,大家一起把這個項目建設好,最終推動WebAssembly生態更好的發展,這也是團隊決定將項目捐贈給CNCF的初衷和期望。“我們第一是希望WebAssembly社區能做好,社區好了之後,才能夠把WasmEdge做大,WasmEdge做大,我們才能夠有前途,這家公司纔會有前途。”"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"採訪嘉賓介紹:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Michael Yuan,畢業於德克薩斯大學奧斯汀分校,獲得博士學位,在開發和商業化開源軟件方面擁有豐富的經驗。Michael 是 JBoss 的早期員工,被 Red Hat 收購之後,作爲產品經理見證了世界上第一個成功的開源商業模式。Michael 著有 5本國際知名出版社出版的技術書籍。2019年 Michael 發起了 WasmEdge 項目,提供下一代雲原生和邊緣計算的執行環境。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"WasmEdge項目地址:"},{"type":"link","attrs":{"href":"https:\/\/github.com\/WasmEdge\/WasmEdge","title":null,"type":null},"content":[{"type":"text","text":"https:\/\/github.com\/WasmEdge\/WasmEdge"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/uploader.shimo.im\/f\/6C3sVYuVgaOgJcG3.jpeg!thumbnail?accessToken=eyJhbGciOiJIUzI1NiIsImtpZCI6ImRlZmF1bHQiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJhY2Nlc3NfcmVzb3VyY2UiLCJleHAiOjE2Mzk0NTY2NjYsImciOiI4cDBHRWZZR3JRVUQ5SVlnIiwiaWF0IjoxNjM5NDU2MzY2LCJ1c2VySWQiOjYxMTUwMDh9.yBaONsyPA44vfckL9soKUqae2wi7RyFpBbnwS7AW_Bg","alt":null,"title":null,"style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"每一位開源參與者、每一個開源項目都可以成爲舞臺上的主角。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"新的一波開源浪潮正在席捲中國,"},{"type":"link","attrs":{"href":"https:\/\/www.infoq.cn\/theme\/opensource","title":null,"type":null},"content":[{"type":"text","text":"【開源聚光燈】"}]},{"type":"text","text":"是InfoQ重點打造的開源主題欄目,旨在通過新聞、系列訪談、用戶調查、迷你書、視頻等形式深入觀察開源運動,圍繞開源的價值和開源開發模式,與投身開源的每一個個體共同探討開源發展現狀,照亮每一個開源舞臺上的參與者。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"如果你有開源故事或對開源的深刻觀點想要分享、或開源項目想要尋求報道,歡迎聯繫微信caifangfang842852(請註明姓名和來由)。"}]}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章