istio.io/archive/v1.5/zh/blog/2020/wasm-announce/index.html

25 lines
38 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html><html lang=zh itemscope itemtype=https://schema.org/WebPage><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=theme-color content="#466BB0"><meta name=title content="重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly"><meta name=description content="Istio 的扩展中使用 WASM 的前景。"><meta name=author content="Craig Box, Mandar Jog, John Plevyak, Louis Ryan, Piotr Sikora (Google), Yuval Kohavi, Scott Weiss (Solo.io)"><meta name=keywords content="microservices,services,mesh,wasm,extensibility,alpha,performance,operator"><meta property="og:title" content="重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly"><meta property="og:type" content="website"><meta property="og:description" content="Istio 的扩展中使用 WASM 的前景。"><meta property="og:url" content="/v1.5/zh/blog/2020/wasm-announce/"><meta property="og:image" content="/v1.5/img/istio-whitelogo-bluebackground-framed.svg"><meta property="og:image:alt" content="Istio Logo"><meta property="og:image:width" content="112"><meta property="og:image:height" content="150"><meta property="og:site_name" content="Istio"><meta name=twitter:card content="summary"><meta name=twitter:site content="@IstioMesh"><title>Istioldie 1.5 / 重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly</title><script async src="https://www.googletagmanager.com/gtag/js?id=UA-98480406-2"></script><script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
gtag('js',new Date());gtag('config','UA-98480406-2');</script><link rel=alternate type=application/rss+xml title="Istio Blog" href=/v1.5/blog/feed.xml><link rel=alternate type=application/rss+xml title="Istio News" href=/v1.5/news/feed.xml><link rel=alternate type=application/rss+xml title="Istio Blog and News" href=/v1.5/feed.xml><link rel="shortcut icon" href=/v1.5/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.5/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.5/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.5/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.5/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.5/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.5/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.5/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.5/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.5/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.5/manifest.json><meta name=apple-mobile-web-app-title content="Istio"><meta name=application-name content="Istio"><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Work+Sans:400|Chivo:400|Work+Sans:500,300,600,300italic,400italic,500italic,600italic|Chivo:500,300,600,300italic,400italic,500italic,600italic"><link rel=stylesheet href=/v1.5/css/all.css><script src=/v1.5/js/themes_init.min.js></script></head><body class="language-unknown archive-site"><script>const branchName="release-1.5";const docTitle="重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly";const iconFile="\/v1.5/img/icons.svg";const buttonCopy='复制到剪切板';const buttonPrint='打印';const buttonDownload='下载';</script><script src="https://www.google.com/cse/brand?form=search-form" defer></script><script src=/v1.5/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.5/zh/><span class=logo><svg viewBox="0 0 300 300"><circle cx="150" cy="150" r="146" stroke-width="2"/><polygon points="65 240 225 240 125 270"/><polygon points="65 230 125 220 125 110"/><polygon points="135 220 225 230 135 30"/></svg></span><span class=name>Istioldie 1.5</span></a><div id=hamburger><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#hamburger"/></svg></div><div id=header-links><a title="了解如何部署、使用和运维 Istio。" href=/v1.5/zh/docs/>文档</a>
<a class=current title="关于使用 Istio 的博客文章。" href=/v1.5/zh/blog/2020/>博客<i class=dot data-prefix=/blog></i></a>
<a title="关于 Istio 项目的最新报道。" href=/v1.5/zh/news/>新闻<i class=dot data-prefix=/news></i></a>
<a title="关于 Istio 的常见问题。" href=/v1.5/zh/faq/>FAQ</a>
<a title="关于 Istio 项目的说明。" href=/v1.5/zh/about/>关于</a><div class=menu><button id=gearDropdownButton class=menu-trigger title=选项和设置 aria-label="Options and Settings" aria-controls=gearDropdownContent><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#gear"/></svg></button><div id=gearDropdownContent class=menu-content aria-labelledby=gearDropdownButton role=menu><a tabindex=-1 role=menuitem lang=en id=switch-lang-en>English</a>
<a tabindex=-1 role=menuitem lang=zh id=switch-lang-zh class=active>中文</a><div role=separator></div><a tabindex=-1 role=menuitem class=active id=light-theme-item>亮主题</a>
<a tabindex=-1 role=menuitem id=dark-theme-item>暗主题</a><div role=separator></div><a tabindex=-1 role=menuitem id=syntax-coloring-item>代码高亮</a><div role=separator></div><h6>本站的其它版本</h6><a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://istio.io/blog\/2020\/wasm-announce\/');return false;">当前版本</a>
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/blog\/2020\/wasm-announce\/');return false;">下个版本</a>
<a tabindex=-1 role=menuitem href=https://istio.io/archive>旧版本</a></div></div><button id=search-show title="搜索 istio.io" aria-label=搜索><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#magnifier"/></svg></button></div><form id=search-form name=cse role=search><input type=hidden name=cx value=002184991200833970123:iwwf17ikgf4>
<input type=hidden name=ie value=utf-8>
<input type=hidden name=hl value=en>
<input type=hidden id=search-page-url value=/v1.5/search>
<input id=search-textbox class=form-control name=q type=search aria-label="搜索 istio.io">
<button id=search-close title=取消搜索 type=reset aria-label=取消搜索><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#cancel-x"/></svg></button></form></nav></header><div class=banner-container></div><main class=primary><div id=sidebar-container class="sidebar-container sidebar-offcanvas"><nav id=sidebar aria-label="Section Navigation"><div class=directory><div class=card><button class="header dynamic" id=card0 title="2020 年的博客文章。" aria-controls=card0-body><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#blog"/></svg>2020 年的博客文章</button><div class="body default" aria-labelledby=card0 role=region id=card0-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card0><li role=none><span role=treeitem class=current title="Istio 的扩展中使用 WASM 的前景。 (2020年3月5日)">重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly</span></li><li role=none><a role=treeitem title="Istio 在 2020 年的愿景声明及路线图。 (2020年3月3日)" href=/v1.5/zh/blog/2020/tradewinds-2020/>Istio 2020——为了商用</a></li><li role=none><a role=treeitem title="一种更安全的秘密管理方式。 (2020年2月20日)" href=/v1.5/zh/blog/2020/istio-agent/>移除跨 pod Unix domain socket</a></li><li role=none><a role=treeitem title="为 Istio deploymentcluster提供自动化 Istio 配置,并让其像单个网格一样工作。 (2020年1月5日)" href=/v1.5/zh/blog/2020/multi-cluster-mesh-automation/>使用 Admiral 管理 Istio 多集群的配置和服务发现</a></li></ul></div></div><div class=card><button class="header dynamic" id=card1 title="2019 年的博客文章。" aria-controls=card1-body><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#blog"/></svg>2019 年的博客文章</button><div class=body aria-labelledby=card1 role=region id=card1-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card1><li role=none><a role=treeitem title="一种更安全管理 Istio webhook 的方法。 (2019年11月14日)" href=/v1.5/zh/blog/2019/webhook/>安全管理 Webhook</a></li><li role=none><a role=treeitem title="关于 Istio 基于 operator 的安装和控制平面管理特性的介绍。 (2019年11月14日)" href=/v1.5/zh/blog/2019/introducing-istio-operator/>Istio Operator 简介</a></li><li role=none><a role=treeitem title="Istio v1beta1 授权策略的设计原则、基本概述及迁移操作。 (2019年11月14日)" href=/v1.5/zh/blog/2019/v1beta1-authorization-policy/>Istio v1beta1 授权策略概述</a></li><li role=none><a role=treeitem title="通过分析 Istio 配置来发现潜在问题和一般问题。 (2019年11月14日)" href=/v1.5/zh/blog/2019/introducing-istioctl-analyze/>istioctl analyze 介绍</a></li><li role=none><a role=treeitem title="在 Istio 中配置和管理 DNS 证书。 (2019年11月14日)" href=/v1.5/zh/blog/2019/dns-cert/>DNS 证书管理</a></li><li role=none><a role=treeitem title="正式启用访问 Istio 资源。 (2019年11月14日)" href=/v1.5/zh/blog/2019/announcing-istio-client-go/>Istio client-go 发布公告</a></li><li role=none><a role=treeitem title="把 Istio 入口网关配置为外部服务的代理。 (2019年10月15日)" href=/v1.5/zh/blog/2019/proxy/>把 Istio 作为外部服务的代理</a></li><li role=none><a role=treeitem title="将需要隔离的环境部署到单独的网格中,并通过网格联邦启用网格间通信。 (2019年10月2日)" href=/v1.5/zh/blog/2019/isolated-clusters/>用于隔离和边界保护的多网格部署</a></li><li role=none><a role=treeitem title="如何使用 Istio 去监控被阻止的和透传的外部服务流量。 (2019年9月28日)" href=/v1.5/zh/blog/2019/monitoring-external-service-traffic/>监控被阻止的和透传的外部服务流量</a></li><li role=none><a role=treeitem title="本文演示 Mixer 进程外适配器实现 Knative scale-from-zero 逻辑的具体过程。 (2019年9月18日)" href=/v1.5/zh/blog/2019/knative-activator-adapter/>适用于 Knative 的 Mixer 适配器</a></li><li role=none><a role=treeitem title="使用 Istio 实现零代码改动保护多云 Kubernetes 应用。 (2019年9月18日)" href=/v1.5/zh/blog/2019/app-identity-and-access-adapter/>APP 身份和访问适配器</a></li><li role=none><a role=treeitem title="利用 Kubernetes 可信任的 JWT 来更安全地为工作负载实例颁发证书。 (2019年9月10日)" href=/v1.5/zh/blog/2019/trustworthy-jwt-sds/>Istio 1.3 Secret 服务发现的更改</a></li><li role=none><a role=treeitem title="Istio API 的设计原则和这些 API 是如何演变的。 (2019年8月5日)" href=/v1.5/zh/blog/2019/evolving-istios-apis/>Istio API 的演变</a></li><li role=none><a role=treeitem title="管控出口流量的备选方案比较,包括性能因素。 (2019年7月22日)" href=/v1.5/zh/blog/2019/egress-traffic-control-in-istio-part-3/>Istio 中安全管控出口流量,第三部分</a></li><li role=none><a role=treeitem title="使用 Istio 的出口流量管控来阻止相关出口流量攻击。 (2019年7月10日)" href=/v1.5/zh/blog/2019/egress-traffic-control-in-istio-part-2/>Istio 中的安全管控出口流量,第二部分</a></li><li role=none><a role=treeitem title="评估 Istio 数据平面性能的工具和指南。 (2019年7月9日)" href=/v1.5/zh/blog/2019/performance-best-practices/>最佳实践Service Mesh 基准性能测试</a></li><li role=none><a role=treeitem title="了解如何延长 Istio 自签名根证书的有效期。 (2019年6月7日)" href=/v1.5/zh/blog/2019/root-transition/>延长 Istio 自签名根证书的有效期</a></li><li role=none><a role=treeitem title="涉及出口流量攻击和出口流量管控要求。 (2019年5月22日)" href=/v1.5/zh/blog/2019/egress-traffic-control-in-istio-part-1/>Istio 中的安全管控出口流量,第一部分</a></li><li role=none><a role=treeitem title="Istio 1.1 性能概览。 (2019年3月19日)" href=/v1.5/zh/blog/2019/istio1.1_perf/>为性能而设计的 Istio 1.1</a></li><li role=none><a role=treeitem title="在多集群服务网格环境中配置 Istio 的路由规则。 (2019年2月7日)" href=/v1.5/zh/blog/2019/multicluster-version-routing/>多集群服务网格中的分版本路由</a></li><li role=none><a role=treeitem title="宣布新的博客策略。 (2019年2月5日)" href=/v1.5/zh/blog/2019/sail-the-blog/>博客策略更新!</a></li><li role=none><a role=treeitem title="揭秘 Istio 是如何将其数据平面组件添加到现有 deployment。 (2019年1月31日)" href=/v1.5/zh/blog/2019/data-plane-setup/>揭开 Istio Sidecar 注入模型的神秘面纱</a></li><li role=none><a role=treeitem title="评估加入 Egress gateway 对性能造成的影响。 (2019年1月31日)" href=/v1.5/zh/blog/2019/egress-performance/>Egress gateway 性能测试</a></li><li role=none><a role=treeitem title="使用 AppSwitch 解决应用程序启动顺序和启动延迟。 (2019年1月14日)" href=/v1.5/zh/blog/2019/appswitch/>使用 AppSwitch 进行 Sidestepping 依赖性排序</a></li><li role=none><a role=treeitem title="Istio 有了一个新的论坛。 (2019年1月10日)" href=/v1.5/zh/blog/2019/announcing-discuss.istio.io/>Istio 论坛成立</a></li><li role=none><a role=treeitem title="如何使用 cert-manager 手工部署一个自定义 Ingress 网关。 (2019年1月10日)" href=/v1.5/zh/blog/2019/custom-ingress-gateway/>使用 Cert-Manager 部署一个自定义 Ingress 网关</a></li></ul></div></div><div class=card><button class="header dynamic" id=card2 title="2018 年的博客文章。" aria-controls=card2-body><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#blog"/></svg>2018 年的博客文章</button><div class=body aria-labelledby=card2 role=region id=card2-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card2><li role=none><a role=treeitem title="如何在不部署 Sidecar 代理的情况下使用 Istio 进行流量管理。 (2018年11月21日)" href=/v1.5/zh/blog/2018/incremental-traffic-management/>增量式应用 Istio 第一部分,流量管理</a></li><li role=none><a role=treeitem title="描述了一个基于 Istio 的 Bookinfo 示例的简单场景。 (2018年11月16日)" href=/v1.5/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a></li><li role=none><a role=treeitem title="Istio 在 Twitch 举办了为期一天的直播庆祝 1.0 的发布。 (2018年8月3日)" href=/v1.5/zh/blog/2018/istio-twitch-stream/>Istio 在 Twitch 上全天直播</a></li><li role=none><a role=treeitem title="惠普如何在 Istio 上构建其下一代鞋类个性化平台。 (2018年7月31日)" href=/v1.5/zh/blog/2018/hp/>Istio 是惠普 FitStation 平台的改变者</a></li><li role=none><a role=treeitem title="使用 AppSwitch 自动接入应用并降低延迟。 (2018年7月30日)" href=/v1.5/zh/blog/2018/delayering-istio/>使用 AppSwitch 精简 Istio 层次</a></li><li role=none><a role=treeitem title="描述 Istio 的授权功能以及如何在各种用例中使用它。 (2018年7月20日)" href=/v1.5/zh/blog/2018/istio-authorization/>基于 Istio 授权的 Micro-Segmentation</a></li><li role=none><a role=treeitem title="如何通过 Stackdriver 将 Istio 访问日志导出到 BigQuery、GCS、Pub/Sub 等不同的接收器。 (2018年7月9日)" href=/v1.5/zh/blog/2018/export-logs-through-stackdriver/>通过 Stackdriver 将日志导出到 BigQuery、GCS、Pub/Sub</a></li><li role=none><a role=treeitem title="描述如何配置 Istio 进行 HTTP Egress 流量监控和访问策略。 (2018年6月22日)" href=/v1.5/zh/blog/2018/egress-monitoring-access-control/>HTTP Egress 流量监控和访问策略</a></li><li role=none><a role=treeitem title="Istio v1alpha3 路由 API 介绍, 动机及其设计原则。 (2018年4月25日)" href=/v1.5/zh/blog/2018/v1alpha3-routing/>Istio v1aplha3 路由 API 介绍</a></li><li role=none><a role=treeitem title="描述如何在 AWS 上使用网络负载均衡器配置 Istio Ingress。 (2018年4月20日)" href=/v1.5/zh/blog/2018/aws-nlb/>使用 AWS NLB 配置 Istio Ingress</a></li><li role=none><a role=treeitem title="使用 Kubernetes 命名空间和 RBAC 为 Istio 构建软性多租户环境。 (2018年4月19日)" href=/v1.5/zh/blog/2018/soft-multitenancy/>Istio 的软性多租户支持</a></li><li role=none><a role=treeitem title="介绍更安全,低风险的部署和发布到生产。 (2018年2月8日)" href=/v1.5/zh/blog/2018/traffic-mirroring/>用于在生产环境进行测试的 Istio 流量镜像功能</a></li><li role=none><a role=treeitem title="描述基于 Istio 的 Bookinfo 示例的简单场景。 (2018年2月6日)" href=/v1.5/zh/blog/2018/egress-tcp/>使用外部 TCP 服务</a></li><li role=none><a role=treeitem title="描述基于 Istio Bookinfo 示例的简单场景。 (2018年1月31日)" href=/v1.5/zh/blog/2018/egress-https/>使用外部 Web 服务</a></li></ul></div></div><div class=card><button class="header dynamic" id=card3 title="2017 年的博客文章。" aria-controls=card3-body><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#blog"/></svg>2017 年的博客文章</button><div class=body aria-labelledby=card3 role=region id=card3-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card3><li role=none><a role=treeitem title="提高可用,降低延迟。 (2017年12月7日)" href=/v1.5/zh/blog/2017/mixer-spof-myth/>Mixer 和 SPOF 神话</a></li><li role=none><a role=treeitem title="概要说明 Mixer 的插件架构。 (2017年11月3日)" href=/v1.5/zh/blog/2017/adapter-model/>Mixer 适配器模型</a></li><li role=none><a role=treeitem title="Istio 的策略如何关联 Kubernetes 的网络策略 。 (2017年8月10日)" href=/v1.5/zh/blog/2017/0.1-using-network-policy/>Istio 使用网络策略</a></li><li role=none><a role=treeitem title="使用 Istio 创建自动缩放的金丝雀部署。 (2017年6月14日)" href=/v1.5/zh/blog/2017/0.1-canary/>使用 Istio 进行金丝雀部署</a></li><li role=none><a role=treeitem title="Istio Auth 0.1 公告。 (2017年5月25日)" href=/v1.5/zh/blog/2017/0.1-auth/>使用 Istio 增强端到端安全</a></li></ul></div></div></div></nav></div><div class=article-container><button tabindex=-1 id=sidebar-toggler title=折叠导航栏><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#pull"/></svg></button><nav aria-label=Breadcrumb><ol><li><a href=/v1.5/zh/ title=用于连接、保护、控制和观测服务。>Istio</a></li><li><a href=/v1.5/zh/blog/ title="关于使用 Istio 的博客文章。">博客</a></li><li><a href=/v1.5/zh/blog/2020/ title="2020 年的博客文章。">2020 年的博客文章</a></li><li>重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly</li></ol></nav><article aria-labelledby=title><div class=title-area><div style=width:100%><h1 id=title>重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly</h1><p class=subtitle>一种针对代理服务扩展的新接口,可以把 Istio 的扩展从控制平面迁移到 sidecar 代理中</p><p class=byline><span>作者</span>
<span class=attribution>Craig Box, Mandar Jog, John Plevyak, Louis Ryan, Piotr Sikora (Google), Yuval Kohavi, Scott Weiss (Solo.io)</span><span> | </span><span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#calendar"/></svg><span>&nbsp;</span>2020年3月5日</span><span> | </span><span title="346 字"><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#clock"/></svg><span>&nbsp;</span>阅读大约需要 2 分钟</span></p></div></div><nav class=toc-inlined aria-label="Table of Contents"><div><hr><ol><li role=none aria-label=背景><a href=#background>背景</a><li role=none aria-label="什么是 WebAssembly"><a href=#what-is-WebAssembly>什么是 WebAssembly</a><li role=none aria-label="把 WebAssembly 引入 Envoy"><a href=#bringing-WebAssembly-to-Envoy>把 WebAssembly 引入 Envoy</a><li role=none aria-label="Istio 中的 WebAssembly 构建"><a href=#building-on-WebAssembly-in-Istio>Istio 中的 WebAssembly 构建</a><li role=none aria-label=开发者体验><a href=#developer-experience>开发者体验</a><li role=none aria-label=下一步><a href=#next-steps>下一步</a><li role=none aria-label=了解更多><a href=#learn-more>了解更多</a><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol><hr></div></nav><p>自 2016 年使用 <a href=https://www.envoyproxy.io/>Envoy</a> 以后Istio 项目一直想提供一个平台,在此平台上可以构建丰富的扩展,以满足用户多样化的需求。有很多要向服务网格的数据平面增加功能的理由 &mdash; 比如:支持更新的协议,与专有安全控件集成,或是通过自定义度量来增强可观察性。</p><p>在过去的一年半中,我们在 Google 的团队一直在努力用 <a href=https://webassembly.org/>WebAssembly</a> 来为 Envoy 代理添加动态扩展。今天我们很高兴与大家分享这项工作,并推出 <a href=https://github.com/proxy-wasm/spec>针对代理的 WebAssembly (Wasm)</a> (Proxy-Wasm):包括一个会标准化的 ABISDK以及它的第一个重点实现新的低延迟的 <a href=/v1.5/zh/docs/reference/config/telemetry>Istio 遥测系统</a></p><p>我们还与社区紧密合作以确保为用户提供良好的开发者体验帮助他们快速上手。Google 团队一直与 <a href=https://solo.io>Solo.io</a> 团队紧密合作Solo 他们已经建立了 <a href=https://webassemblyhub.io/>WebAssembly Hub</a> 服务,用于构建,共享,发现和部署 Wasm 扩展。有了 WebAssembly HubWasm 扩展就会像容器一样易于管理,安装和运行。</p><p>这个项目现在发布了 Alpha 版本,仍然还有很多<a href=#next-steps>工作要做</a>,但是我们很高兴将其交提供给开发者,以便他们可以开始尝试由此带来的巨大可能性。</p><h2 id=background>背景</h2><p>可扩展需求一直都是 Istio 和 Envoy 项目的基本原则但是两个项目采用了不同的实现方式。Istio 项目的做法是启用一个通用的进程外扩展模型,叫做 <a href=/v1.5/zh/docs/reference/config/policy-and-telemetry/mixer-overview/>Mixer</a>,以此带来轻量级的开发者体验,而 Envoy 则专注于代理内<a href=https://www.envoyproxy.io/docs/envoy/latest/extending/extending>扩展</a></p><p>每种方法都各有利弊。Istio 模型导致明显的资源效率低下,从而影响了尾部延迟和资源利用率。该模型在根本上来说是有局限性的 - 例如,它永远不会支持实现<a href=https://blog.envoyproxy.io/how-to-write-envoy-filters-like-a-ninja-part-1-d166e5abec09>自定义协议处理</a></p><p>Envoy 模型强化了单体构建过程,并要求使用 C++ 编写扩展,从而限制了开发者的生态。给集群发布新的扩展需要下发新的二进制文件并滚动重启,这可能很难协调,并有可能会导致停机。这也促使了开发者向 Envoy 上游提交他们的扩展,而这些扩展仅由一小部分生产环境使用,更多仅仅是为了利用其发布机制。</p><p>随着时间的流逝Istio 的一些对性能最敏感的功能已合进了上游的 Envoy - 例如<a href=https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/rbac_filter>流量检查策略</a>和例如<a href=/v1.5/zh/docs/reference/config/telemetry/metrics/>遥测上报</a>。尽管如此,我们一直想把扩展汇聚在一个技术栈上,从而减少两者之间犹豫的权衡:这使 Envoy 版本与其扩展生态系统脱钩,使开发者能够使用他们选择的语言进行工作,并使 Istio 可靠地推出新功能而不必有停机风险。</p><h2 id=what-is-WebAssembly>什么是 WebAssembly</h2><p><a href=https://webassembly.org/>WebAssembly</a>Wasm是一种由<a href=https://github.com/appcypher/awesome-wasm-langs>多种语言</a>编写的,可移植的字节码格式,它能以以接近本机的速度执行。其最初的<a href=https://webassembly.org/docs/high-level-goals/>设计目标</a>与上述挑战很相符并且在其背后得到了相当大的行业支持。Wasm 是在所有主流浏览器中可以本地运行的第四种标准语言(继 HTMLCSS 和 JavaScript 之后),于 2019 年 12 月成为 <a href=https://www.w3.org/TR/wasm-core-1/>W3C 正式建议</a>。这使我们有信心对其进行战略下注。</p><p>尽管 WebAssembly 最初是作为客户端技术而诞生,但它在服务器上用也有很多优势。运行时是内存安全的,并且以沙盒方式运行以确保安全。它有一个很大的工具生态系统,用于以文本或二进制格式编译和调试 Wasm。<a href=https://www.w3.org/>W3C</a><a href=https://bytecodealliance.org/>BytecodeAlliance</a> 已成为其它服务器端工作的活跃中心。比如Wasm 社区正在 W3C 中标准化 <a href=https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/>&ldquo;WebAssembly 系统接口 Interface&rdquo; (WASI)</a>,并通过一个示例实现,它为 Wasm “程序” 提供了一个类似 OS 的抽象。</p><h2 id=bringing-WebAssembly-to-Envoy>把 WebAssembly 引入 Envoy</h2><p><a href=https://github.com/envoyproxy/envoy/issues/4272>在过去的18个月中</a>,我们一直与 Envoy 社区合作把 Wasm 的扩展引入 Envoy并将其贡献到上游。我们很高兴地宣布此特性在 <a href=/v1.5/zh/news/releases/1.5.x/announcing-1.5/>Istio 1.5</a> 自带的 Envoy 中以 Alpha 版本可用了,其源代码在 <a href=https://github.com/envoyproxy/envoy-wasm/><code>envoy-wasm</code></a> 开发分支中,并且正在努力将其合并到 Envoy 主干上。该实现使用了 Google 高性能 <a href=https://v8.dev/>V8 引擎</a> 中内置的 WebAssembly 运行时。</p><p>除了构建底层的运行时,我们还构建了:</p><ul><li>把 Wasm 嵌入代理的通用应用程序二进制接口ABI这意味着编译后的扩展将可以在不同版本的 Envoy 中工作,甚至其它代理也可以,当然当然,其它代理得实现 ABI。</li><li><a href=https://github.com/proxy-wasm/proxy-wasm-cpp-sdk>C++</a>,
<a href=https://github.com/proxy-wasm/proxy-wasm-rust-sdk>Rust</a><a href=https://github.com/solo-io/proxy-runtime>AssemblyScript</a> 可以方便进行扩展开发的 SDK后续还有很多语言支持</li><li>全面的<a href=https://docs.solo.io/web-assembly-hub/latest/tutorial_code/>示例和说明</a>介绍如何在 Istio 和独立的 Envoy 中部署</li><li>允许使用其它 Wasm 运行时的抽象,包括把本地把扩展直接编译进 Envoy 中 “null” 运行时,这对于测试和调试非常有用</li></ul><p>使用 Wasm 扩展 Envoy 带来了几个主要好处:</p><ul><li>敏捷性:可以用 Istio 控制平面在运行时下发和重载扩展。这就可以快速的进行扩展开发→测试→发布周期,而无需重启 Envoy。</li><li>发布库一旦完成合并到主树中之后Istio 和其它程序将能够使用 Envoy 的发布库,而不是自己构建。这也方便 Envoy 社区迁移某些内置扩展到这个模型,从而减少他们的工作。</li><li>可靠性和隔离性:扩展部署在具有资源限制的沙箱中,这意味着它们现在可以崩溃或泄漏内存,但不会让整个 Envoy 挂掉。CPU 和内存使用率也可以受到限制。</li><li>安全性:沙盒具有一个明确定义的 API用于和 Envoy 通信,因此扩展只能访问和修改链接或者请求中有限数量的属性。此外,由于 Envoy 协调整个交互因此它可以隐藏或清除扩展中的敏感信息例如HTTP 头中的 “Authorization”和“Cookie”或者客户端的 IP 地址)。</li><li>灵活性:<a href=https://github.com/appcypher/awesome-wasm-langs>可以将超过 30 种编程语言编译为 WebAssembly</a>,可以让各种技术背景的开发人员都可以用他们选择的语言来编写 Envoy 扩展比如C++GoRustJavaTypeScript 等。</li></ul><p>“看到 Envoy 上支持了 WASM我感到非常兴奋这是 Envoy 可扩展的未来。Envoy 的 WASM 支持与社区驱动的 hub 相结合,将在服务网格和 API 网关用例中开启出令人难以置信的网络创新。 我迫不及待地想看到社区构建是如何向前发展的。” Envoy 创造者 Matt Klein。</p><p>有关实现的技术细节,请关注即将在 <a href=https://blog.envoyproxy.io/>Envoy 博客</a>上发的文章。</p><p>主机环境和扩展之间的 <a href=https://github.com/proxy-wasm>Proxy-Wasm</a>接口有意设计为代理无感知的。我们已将其内置到了 Envoy 中,但它是为其它代理供应商设计的。我们希望看为 Istio 和 Envoy 编写的扩展也可以在其它基础设施中运行。很快就会有更多相关的设计和实现了。</p><h2 id=building-on-WebAssembly-in-Istio>Istio 中的 WebAssembly 构建</h2><p>为了显著提高性能Istio 在 1.5 的发布中,把它的几个扩展内置到了 Envoy 中。在执行此工作时,我们把这些同样的扩展可以作为 Proxy-Wasm 模块进行编译和运行,测试确保其行为没有异常。考虑到我们认为 Wasm 支持还是 Alpha 版本,我们还没有完全准备好将这个设置设为默认设置;然而,在我们的通用实现和主机环境还是给了我们不少信心,至少 ABI 和 SDK 已经开发完成了。</p><p>我们还是要小心地确保 Istio 控制平面及其 <a href=/v1.5/zh/docs/reference/config/networking/envoy-filter/>Envoy 配置 API</a> 已经可以支持 Wasm。我们有一些示例来展示几种常见的定制例如定制头解码或程序中路由这是用户的常见要求。当将这个支持发展到 Beta 版本时,将会看到 Istio 中使用 Wasm 最佳实践的文档。</p><p>最后,我们正在与许多编写了 <a href=/v1.5/zh/docs/reference/config/policy-and-telemetry/adapters/>Mixer 适配器</a>的供应商合作,帮助他们迁移到 Wasm — 如果这是前行的最佳方式。Mixer 将在未来的版本中转为社区项目,它将仍可用于老系统。</p><h2 id=developer-experience>开发者体验</h2><p>没有出色的开发者体验再强大的工具也毫无用处。Solo.io <a href=https://www.solo.io/blog/an-extended-and-improved-webassembly-hub-to-helps-bring-the-power-of-webassembly-to-envoy-and-istio/>最近宣布</a>发布 <a href=https://webassemblyhub.io/>WebAssembly Hub</a>,这是一套为 Envoy 和 Istio 做的,用于构建,部署,共享和发现 Envoy Proxy Wasm 扩展的工具和仓库。</p><p>WebAssembly Hub 把为开发和部署 Wasm 扩展所需的许多步骤都完全自动化了。使用 WebAssembly Hub 工具,用户可以轻松地把任何受支持语言开发的代码编译为 Wasm 扩展。可以将这些扩展上传到 Hub 仓库,并且用单个命令就将其在 Istio 中部署和删除。</p><p>在后台Hub 处理了很多细节问题例如引入正确的工具链、ABI 版本验证、权限控制等等。该工作流程还通过自动化扩展部署,消除了跨 Istio 服务代理的配置更改带来的麻烦。此工具帮助用户和操作员避免由于配置错误或版本不匹配而导致的意外行为。</p><p>WebAssembly Hub 工具提供了功能强大的 CLI 和优雅且易于使用的图形用户界面。WebAssembly Hub 的一个重要目标是简化围绕构建 Wasm 模块的体验,并为开发者提供共享和发现有用扩展的协作场所。</p><p>请查看<a href=https://docs.solo.io/web-assembly-hub/latest/tutorial_code/>入门指南</a>,以创建您的第一个 Proxy-Wasm 扩展。</p><h2 id=next-steps>下一步</h2><p>除了努力发布 Beta 版,我们还致力于确保围绕 Proxy-Wasm 有一个持久的社区。ABI 需要最终确定,而将其转变为标准的工作将会在适当的标准机构内获得更广泛的反馈后完成。完成向 Envoy 主干提供上游支持的工作仍在进行中。我们还在为工具和 WebAssembly Hub 寻找合适的社区。</p><h2 id=learn-more>了解更多</h2><ul><li>WebAssembly SF talk (视频): <a href="https://www.youtube.com/watch?v=OIUPf8m7CGA">网络代理扩展</a>, by John Plevyak</li><li><a href=https://www.solo.io/blog/an-extended-and-improved-webassembly-hub-to-helps-bring-the-power-of-webassembly-to-envoy-and-istio/>Solo 博客</a></li><li><a href=https://github.com/proxy-wasm/spec>Proxy-Wasm ABI 说明</a></li><li><a href=https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/blob/master/docs/wasm_filter.md>Proxy-Wasm C++ SDK</a> 和其 <a href=https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/blob/master/docs/wasm_filter.md>开发者文档</a></li><li><a href=https://github.com/proxy-wasm/proxy-wasm-rust-sdk>Proxy-Wasm Rust SDK</a></li><li><a href=https://github.com/solo-io/proxy-runtime>Proxy-Wasm AssemblyScript SDK</a></li><li><a href=https://docs.solo.io/web-assembly-hub/latest/tutorial_code/>指南</a></li><li><a href=https://www.youtube.com/channel/UCuketWAG3WqYjjxtQ9Q8ApQ>Solo.io Youtube 频道</a>上的视频</li></ul><nav id=see-also><h2>相关内容</h2><div class=see-also><div class=entry><p class=link><a data-skipendnotes=true href=/v1.5/zh/blog/2020/tradewinds-2020/>Istio 2020——为了商用</a></p><p class=desc>Istio 在 2020 年的愿景声明及路线图。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.5/zh/blog/2019/introducing-istio-operator/>Istio Operator 简介</a></p><p class=desc>关于 Istio 基于 operator 的安装和控制平面管理特性的介绍。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.5/zh/blog/2019/performance-best-practices/>最佳实践Service Mesh 基准性能测试</a></p><p class=desc>评估 Istio 数据平面性能的工具和指南。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.5/zh/blog/2019/istio1.1_perf/>为性能而设计的 Istio 1.1</a></p><p class=desc>Istio 1.1 性能概览。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.5/zh/blog/2019/egress-performance/>Egress gateway 性能测试</a></p><p class=desc>评估加入 Egress gateway 对性能造成的影响。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.5/zh/blog/2019/appswitch/>使用 AppSwitch 进行 Sidestepping 依赖性排序</a></p><p class=desc>使用 AppSwitch 解决应用程序启动顺序和启动延迟。</p></div></div></nav></article><nav class=pagenav><div class=left></div><div class=right><a title="Istio 在 2020 年的愿景声明及路线图。" href=/v1.5/zh/blog/2020/tradewinds-2020/>Istio 2020——为了商用<svg class="icon"><use xlink:href="/v1.5/img/icons.svg#right-arrow"/></svg></a></div></nav><div id=feedback><div id=feedback-initial>这些信息有用吗?<br><button class="btn feedback" onclick="sendFeedback('zh',1)">是的</button>
<button class="btn feedback" onclick="sendFeedback('zh',0)">没有</button></div><div id=feedback-comment>Do you have any suggestions for improvement?<br><br><input id=feedback-textbox type=text placeholder="Help us improve..." data-lang=zh></div><div id=feedback-thankyou>Thanks for your feedback!</div></div><div id=endnotes-container aria-hidden=true><h2>链接</h2><ol id=endnotes></ol></div></div><div class=toc-container><nav class=toc aria-label="Table of Contents"><div id=toc><ol><li role=none aria-label=背景><a href=#background>背景</a><li role=none aria-label="什么是 WebAssembly"><a href=#what-is-WebAssembly>什么是 WebAssembly</a><li role=none aria-label="把 WebAssembly 引入 Envoy"><a href=#bringing-WebAssembly-to-Envoy>把 WebAssembly 引入 Envoy</a><li role=none aria-label="Istio 中的 WebAssembly 构建"><a href=#building-on-WebAssembly-in-Istio>Istio 中的 WebAssembly 构建</a><li role=none aria-label=开发者体验><a href=#developer-experience>开发者体验</a><li role=none aria-label=下一步><a href=#next-steps>下一步</a><li role=none aria-label=了解更多><a href=#learn-more>了解更多</a><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol></div></nav></div></main><footer><div class=user-links><a class=channel title="立刻下载 Istio 1.5.4" href=/v1.5/docs/setup/getting-started/#download aria-label="Download Istio"><span>download</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#download"/></svg>
</a><a class=channel title="加入 Istio discussion board 参与讨论获取帮助" href=https://discuss.istio.io aria-label="Istio discussion board"><span>discuss</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#discourse"/></svg></a>
<a class=channel title="Stack Overflow 中列举了针对实际问题以及部署、配置和使用 Istio 的各项回答" href=https://stackoverflow.com/questions/tagged/istio aria-label="Stack Overflow"><span>stack overflow</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#stackoverflow"/></svg></a>
<a class=channel title="在 Slack 上与 Istio 社区交互讨论开发问题(仅限邀请)" href=https://istio.slack.com aria-label=slack><span>slack</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#slack"/></svg></a>
<a class=channel title="关注我们的 Twitter 来获取最新信息" href=https://twitter.com/IstioMesh aria-label=Twitter><span>twitter</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
1.5.4<br>&copy; 2020 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2020年5月21日</p></div><div class=dev-links><a class=channel title="Istio 的代码在 GitHub 上开发" href=https://github.com/istio/community aria-label=GitHub><span>github</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#github"/></svg></a>
<a class=channel title="如果您想深入了解 Istio 的技术细节,请查看我们日益完善的设计文档" href=https://groups.google.com/forum/#!forum/istio-team-drive-access aria-label="team drive"><span>drive</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#drive"/></svg></a>
<a class=channel title="如果您想为 Istio 项目做出贡献,请考虑加入我们的工作组" href=https://github.com/istio/community/blob/master/WORKING-GROUPS.md aria-label="working groups"><span>working groups</span><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#working-groups"/></svg></a><div class=tag>对于开发者</div></div></footer><div id=scroll-to-top-container aria-hidden=true><button id=scroll-to-top title=回到顶部><svg class="icon"><use xlink:href="/v1.5/img/icons.svg#top"/></svg></button></div></body></html>