istio.io/archive/v1.2/zh/blog/2019/egress-performance/index.html

24 lines
32 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="Egress gateway 性能测试"><meta name=description content="评估加入 Egress gateway 对性能造成的影响。"><meta name=author content="Jose Nativio, IBM"><meta name=keywords content=microservices,services,mesh,performance,traffic-management,egress,mongo><meta property=og:title content="Egress gateway 性能测试"><meta property=og:type content=website><meta property=og:description content="评估加入 Egress gateway 对性能造成的影响。"><meta property=og:url content=/v1.2/zh/blog/2019/egress-performance/><meta property=og:image content=/v1.2/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.2 / Egress gateway 性能测试</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.2/feed.xml><link rel="shortcut icon" href=/v1.2/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.2/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.2/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.2/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.2/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.2/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.2/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.2/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.2/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.2/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.2/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.2/css/all.css><script src=/v1.2/js/themes_init.min.js></script></head><body class="language-unknown archive-site"><script>const branchName="release-1.2";const docTitle="Egress gateway 性能测试";const iconFile="\/v1.2/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.2/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.2/zh/><span class=logo><svg viewBox="0 0 300 300"><circle cx="150" cy="150" r="146" stroke-width="2" /><path d="M65 240H225L125 270z"/><path d="M65 230l60-10V110z"/><path d="M135 220l90 10L135 30z"/></svg></span><span class=name>Istioldie 1.2</span></a><div id=hamburger><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#hamburger"/></svg></div><div id=header-links><a title="了解如何部署、使用和运维 Istio。" href=/v1.2/zh/docs/>文档</a>
<span title="关于使用 Istio 的博客文章。">博客</span>
<a title=关于Istio的常见问题。 href=/v1.2/zh/faq/>FAQ</a>
<a title=关于Istio的说明。 href=/v1.2/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.2/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\/2019\/egress-performance\/');return false;">当前版本</a>
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/blog\/2019\/egress-performance\/');return false;">下个版本</a>
<a tabindex=-1 role=menuitem href=https://archive.istio.io>旧版本</a></div></div><button id=search-show title=搜索istio.io aria-label=Search><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#magnifier"/></svg></button></div><form id=search-form name=cse role=search><input type=hidden name=cx value=013699703217164175118: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.2/search.html>
<input id=search-textbox class=form-control name=q type=search aria-label=搜索istio.io>
<button id=search-close title="Cancel search" type=reset aria-label="Cancel search"><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#cancel-x"/></svg></button></form></nav></header><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="2019 年的博客文章。" aria-controls=card0-body><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#blog"/></svg>2019 年的博客文章</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><a role=treeitem title="Istio 1.1.3。" href=/v1.2/zh/blog/2019/announcing-1.1.3/>安全更新:发布 Istio 1.1.3</a></li><li role=none><a role=treeitem title="Istio 1.0.7 的补丁版本。" href=/v1.2/zh/blog/2019/announcing-1.0.7/>安全更新:发布 Istio 1.0.7</a></li><li role=none><a role=treeitem title="Istio 1.1.2 的补丁版本。" href=/v1.2/zh/blog/2019/announcing-1.1.2/>安全更新:发布 Istio 1.1.2</a></li><li role=none><a role=treeitem title="Istio 1.1 发布声明。" href=/v1.2/zh/blog/2019/announcing-1.1/>宣布 Istio 1.1 发布</a></li><li role=none><a role=treeitem title="Istio 1.1 性能概览." href=/v1.2/zh/blog/2019/istio1.1_perf/>面向性能而架构的 Istio 1.1</a></li><li role=none><a role=treeitem title="Istio 1.0.6 补丁版本。" href=/v1.2/zh/blog/2019/announcing-1.0.6/>Istio 1.0.6 发布</a></li><li role=none><a role=treeitem title="在多集群服务网格环境中配置 Istio 的路由规则。" href=/v1.2/zh/blog/2019/multicluster-version-routing/>多集群服务网格中的分版本路由</a></li><li role=none><a role=treeitem title=宣布新的博客策略。 href=/v1.2/zh/blog/2019/sail-the-blog/>博客策略更新</a></li><li role=none><span role=treeitem class=current title="评估加入 Egress gateway 对性能造成的影响。">Egress gateway 性能测试</span></li><li role=none><a role=treeitem title="Istio 将数据面组件注入到现存部署之中的过程。" href=/v1.2/zh/blog/2019/data-plane-setup/>Istio Sidecar 注入过程解密</a></li><li role=none><a role=treeitem title="使用 AppSwitch 解决应用程序启动顺序和启动延迟。" href=/v1.2/zh/blog/2019/appswitch/>使用 AppSwitch 进行 Sidestepping 依赖性排序</a></li><li role=none><a role=treeitem title="如何使用 cert-manager 手工部署一个自定义 Ingress 网关。" href=/v1.2/zh/blog/2019/custom-ingress-gateway/>使用 Cert-Manager 部署一个自定义 Ingress 网关</a></li><li role=none><a role=treeitem title="Istio 推出新的讨论板。" href=/v1.2/zh/blog/2019/announcing-discuss.istio.io/>宣布 discuss.istio.io</a></li></ul></div></div><div class=card><button class="header dynamic" id=card1 title="2017 年的博客文章。" aria-controls=card1-body><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#blog"/></svg>2017 年的博客文章</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=提高可用,降低延迟。 href=/v1.2/zh/blog/2017/mixer-spof-myth/>Mixer 和 SPOF 神话</a></li><li role=none><a role=treeitem title="概要说明 Mixer 的插件架构。" href=/v1.2/zh/blog/2017/adapter-model/>Mixer 适配器模型</a></li><li role=none><a role=treeitem title="Istio 0.2 公告。" href=/v1.2/zh/blog/2017/0.2-announcement/>宣布 Istio 0.2</a></li><li role=none><a role=treeitem title="Istio 的策略如何关联 Kubernetes 的网络策略 。" href=/v1.2/zh/blog/2017/0.1-using-network-policy/>Istio 使用网络策略</a></li><li role=none><a role=treeitem title="使用 Istio 创建自动缩放的金丝雀部署。" href=/v1.2/zh/blog/2017/0.1-canary/>使用 Istio 进行金丝雀部署</a></li><li role=none><a role=treeitem title="Istio Auth 0.1 公告。" href=/v1.2/zh/blog/2017/0.1-auth/>使用 Istio 增强端到端安全</a></li><li role=none><a role=treeitem title="Istio 0.1 宣布。" href=/v1.2/zh/blog/2017/0.1-announcement/>初次了解 Istio</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.2/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="Istio 1.0.5 补丁版本发布。" href=/v1.2/zh/blog/2018/announcing-1.0.5/>Istio 1.0.5 发布</a></li><li role=none><a role=treeitem title="Istio 1.0.4 补丁版本发布。" href=/v1.2/zh/blog/2018/announcing-1.0.4/>Istio 1.0.4 发布</a></li><li role=none><a role=treeitem title="如何在不部署 Sidecar 代理的情况下使用 Istio 进行流量管理。" href=/v1.2/zh/blog/2018/incremental-traffic-management/>增量式应用 Istio 第一部分,流量管理</a></li><li role=none><a role=treeitem title="描述了一个基于 Istio 的 Bookinfo 示例的简单场景。" href=/v1.2/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a></li><li role=none><a role=treeitem title="Istio 1.0.3 修补版本。" href=/v1.2/zh/blog/2018/announcing-1.0.3/>宣布 Istio 1.0.3</a></li><li role=none><a role=treeitem title="Istio 1.0.2 补丁版本." href=/v1.2/zh/blog/2018/announcing-1.0.2/>Istio 1.0.2 发布</a></li><li role=none><a role=treeitem title="Istio 1.0.1 补丁版本。" href=/v1.2/zh/blog/2018/announcing-1.0.1/>Istio 1.0.1 发布</a></li><li role=none><a role=treeitem title="Istio 在 Twitch 举办了为期一天的直播庆祝 1.0 的发布。" href=/v1.2/zh/blog/2018/istio-twitch-stream/>Istio 在 Twitch 上全天直播</a></li><li role=none><a role=treeitem title="惠普如何在 Istio 上构建其下一代鞋类个性化平台。" href=/v1.2/zh/blog/2018/hp/>Istio 是惠普 FitStation 平台的改变者</a></li><li role=none><a role=treeitem title="Istio 1.0 已生产就绪。" href=/v1.2/zh/blog/2018/announcing-1.0/>宣布 Istio 1.0</a></li><li role=none><a role=treeitem title="使用 AppSwitch 自动接入应用并降低延迟。" href=/v1.2/zh/blog/2018/delayering-istio/>使用 AppSwitch 精简 Istio 层次</a></li><li role=none><a role=treeitem title="描述 Istio 的授权功能以及如何在各种用例中使用它。" href=/v1.2/zh/blog/2018/istio-authorization/>基于 Istio 的 Micro-Segmentation 授权</a></li><li role=none><a role=treeitem title="如何通过 Stackdriver 将 Istio 访问日志导出到 BigQuery、GCS、Pub/Sub 等不同的接收器。" href=/v1.2/zh/blog/2018/export-logs-through-stackdriver/>通过 Stackdriver 将日志导出到 BigQuery、GCS、Pub/Sub</a></li><li role=none><a role=treeitem title="描述如何配置 Istio 进行 HTTP Egress 流量监控和访问策略。" href=/v1.2/zh/blog/2018/egress-monitoring-access-control/>HTTP Egress 流量监控和访问策略</a></li><li role=none><a role=treeitem title="Istio v1alpha3 路由 API 介绍,动机及其设计原则。" href=/v1.2/zh/blog/2018/v1alpha3-routing/>Istio v1aplha3 路由 API 介绍</a></li><li role=none><a role=treeitem title="描述如何在AWS上使用网络负载均衡器配置 Istio Ingress。" href=/v1.2/zh/blog/2018/aws-nlb/>使用AWS NLB 配置 Istio Ingress</a></li><li role=none><a role=treeitem title="使用 Kubernetes 命名空间和 RBAC 为 Istio 构建软性多租户环境。" href=/v1.2/zh/blog/2018/soft-multitenancy/>Istio 的软性多租户支持</a></li><li role=none><a role=treeitem title=介绍更安全,低风险的部署和发布到生产。 href=/v1.2/zh/blog/2018/traffic-mirroring/>用于在生产环境进行测试的 Istio 流量镜像功能</a></li><li role=none><a role=treeitem title="描述基于 Istio 的 Bookinfo 示例的简单场景。" href=/v1.2/zh/blog/2018/egress-tcp/>使用外部 TCP 服务</a></li><li role=none><a role=treeitem title="描述基于 Istio Bookinfo 示例的简单场景。" href=/v1.2/zh/blog/2018/egress-https/>使用外部 Web 服务</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.2/img/icons.svg#pull"/></svg></button><nav aria-label=Breadcrumb><ol><li><a href=/v1.2/zh/>Istio</a></li><li><a href=/v1.2/zh/blog/ title="关于使用 Istio 的博客文章。">博客</a></li><li><a href=/v1.2/zh/blog/2019/ title="2019 年的博客文章。">2019 年的博客文章</a></li><li>Egress gateway 性能测试</li></ol></nav><article aria-labelledby=title><div class=title-area><div><h1 id=title>Egress gateway 性能测试</h1><p class=subtitle>Istio Egress gateway 性能评估</p><p class=byline><span>作者</span>
<span class=attribution>Jose Nativio, IBM</span><span> | </span><span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#calendar"/></svg><span>&nbsp;</span>2019年1月31日</span><span> | </span><span title="244 字"><svg class="icon"><use xlink:href="/v1.2/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="Egress 流量案例"><a href=#egress-%e6%b5%81%e9%87%8f%e6%a1%88%e4%be%8b>Egress 流量案例</a><ol><li role=none aria-label="案例 1绕过 Sidecar"><a href=#%e6%a1%88%e4%be%8b-1-%e7%bb%95%e8%bf%87-sidecar>案例 1绕过 Sidecar</a><li role=none aria-label="案例 2使用 Service Entry通过 Sidecar 完成访问"><a href=#%e6%a1%88%e4%be%8b-2-%e4%bd%bf%e7%94%a8-service-entry-%e9%80%9a%e8%bf%87-sidecar-%e5%ae%8c%e6%88%90%e8%ae%bf%e9%97%ae>案例 2使用 Service Entry通过 Sidecar 完成访问</a><li role=none aria-label="案例 3: Egress gateway"><a href=#%e6%a1%88%e4%be%8b-3-egress-gateway>案例 3: Egress gateway</a><li role=none aria-label="案例 4在 Sidecar 和 Egress gateway 之间的双向 TLS"><a href=#%e6%a1%88%e4%be%8b-4-%e5%9c%a8-sidecar-%e5%92%8c-egress-gateway-%e4%b9%8b%e9%97%b4%e7%9a%84%e5%8f%8c%e5%90%91-tls>案例 4在 Sidecar 和 Egress gateway 之间的双向 TLS</a><li role=none aria-label="案例 5带有 SNI proxy 的 Egress gateway"><a href=#%e6%a1%88%e4%be%8b-5-%e5%b8%a6%e6%9c%89-sni-proxy-%e7%9a%84-egress-gateway>案例 5带有 SNI proxy 的 Egress gateway</a></ol></li><li role=none aria-label=环境><a href=#%e7%8e%af%e5%a2%83>环境</a><li role=none aria-label=结果><a href=#%e7%bb%93%e6%9e%9c>结果</a><ol><li role=none aria-label=吞吐量><a href=#%e5%90%9e%e5%90%90%e9%87%8f>吞吐量</a><li role=none aria-label=响应时间><a href=#%e5%93%8d%e5%ba%94%e6%97%b6%e9%97%b4>响应时间</a><li role=none aria-label="CPU 用量"><a href=#cpu-%e7%94%a8%e9%87%8f>CPU 用量</a></ol></li><li role=none aria-label=结论><a href=#%e7%bb%93%e8%ae%ba>结论</a><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol><hr></div></nav><p>为了从网格中访问外部服务(本例中使用的是 MongoDB需要加入 Egress gateway本次测试的主要目的就是调查这一行为对性能和资源使用造成的影响。在博客<a href=/v1.2/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a>中介绍了为外部 MongoDB 配置 Egress gateway 的具体步骤。</p><p>本次测试中使用的应用是 Acmeair 的 Java 版,这个应用会模拟一个航空订票系统。在 Istio 的每日构建中会使用该应用来进行性能的回归测试,但是在回归测试过程中,这些应用会使用自己的 Sidecar 来访问外部的 MongoDB而不是 Egress gateway。</p><p>下图描述了目前的 Istio 回归测试过程中Acmeair 应用的运行方式:</p><figure style=width:70%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:62.69230769230769%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./acmeair_regpatrol3.png title="在 Istio 性能回归测试环境中的 Acmeair 基准测试"><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./acmeair_regpatrol3.png alt="在 Istio 性能回归测试环境中的 Acmeair 基准测试"></a></div><figcaption>在 Istio 性能回归测试环境中的 Acmeair 基准测试</figcaption></figure><p>还有一个差别就是,这一应用和外部数据库使用的是明文的 MongoDB 协议。本文中的第一个变化就是将应用到外部 MongoDB 之间的连接升级为 TLS 模式,以体现更贴近实际情况的场景。</p><p>下面会讲到一些从网格中访问外部数据库的具体案例。</p><h2 id=egress-流量案例>Egress 流量案例</h2><h3 id=案例-1-绕过-sidecar>案例 1绕过 Sidecar</h3><p>在这个案例中Sidecar 对应用和外部数据库之间的通信不做拦截。这一配置是通过初始化容器中的 <code>-x</code> 参数来完成的,将其内容设置为 MongoDB 的 CIDR 即可。这种做法导致 Sidecar 忽略流入/流出指定 IP 地址的流量。举例来说:</p><pre><code> - -x
- &quot;169.47.232.211/32&quot;
</code></pre><figure style=width:70%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:76.45536869340232%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./case1_sidecar_bypass3.png title="绕过 Sidecar 和外部 MongoDB 进行通信"><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./case1_sidecar_bypass3.png alt="绕过 Sidecar 和外部 MongoDB 进行通信"></a></div><figcaption>绕过 Sidecar 和外部 MongoDB 进行通信</figcaption></figure><h3 id=案例-2-使用-service-entry-通过-sidecar-完成访问>案例 2使用 Service Entry通过 Sidecar 完成访问</h3><p>在 Sidecar 已经注入到应用 Pod 之后,这种方式是缺省(访问外部服务)的方式。所有的流量都被 Sidecar 拦截,然后根据配置好的规则路由到目的地,这里所说的目的地也包含了外部服务。下面为 MongoDB 配置一个 <code>ServiceEntry</code></p><figure style=width:70%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:74.41253263707573%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./case2_sidecar_passthru3.png title="Sidecar 拦截对外部 MongoDB 的流量"><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./case2_sidecar_passthru3.png alt="Sidecar 拦截对外部 MongoDB 的流量"></a></div><figcaption>Sidecar 拦截对外部 MongoDB 的流量</figcaption></figure><h3 id=案例-3-egress-gateway>案例 3: Egress gateway</h3><p>配置 Egress gateway 以及配套的 Destination rule 和 Virtual service用于访问 MongoDB。所有进出外部数据库的流量都从 Egress gatewayEnvoy通过。</p><figure style=width:70%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:62.309368191721134%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./case3_egressgw3.png title="使用 Egress gateway 访问 MongoDB"><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./case3_egressgw3.png alt="使用 Egress gateway 访问 MongoDB"></a></div><figcaption>使用 Egress gateway 访问 MongoDB</figcaption></figure><h3 id=案例-4-在-sidecar-和-egress-gateway-之间的双向-tls>案例 4在 Sidecar 和 Egress gateway 之间的双向 TLS</h3><p>这种方式中,在 Sidecar 和 Gateway 之中多出了一个安全层,所以会影响性能。</p><figure style=width:70%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:63.968957871396896%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./case4_egressgw_mtls3.png title="在 Sidecar 和 Egress gateway 之间启用双向 TLS"><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./case4_egressgw_mtls3.png alt="在 Sidecar 和 Egress gateway 之间启用双向 TLS"></a></div><figcaption>在 Sidecar 和 Egress gateway 之间启用双向 TLS</figcaption></figure><h3 id=案例-5-带有-sni-proxy-的-egress-gateway>案例 5带有 SNI proxy 的 Egress gateway</h3><p>这个场景中,因为 Envoy 目前存在的一些限制,需要另一个代理来访问通配符域名。这里创建了一个 Nginx 代理,在 Egress gateway Pod 中作为 Sidecar 来使用。</p><figure style=width:70%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:65.2762119503946%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./case5_egressgw_sni_proxy3.png title="带有 SNI proxy 的 Egress gateway"><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./case5_egressgw_sni_proxy3.png alt="带有 SNI proxy 的 Egress gateway"></a></div><figcaption>带有 SNI proxy 的 Egress gateway</figcaption></figure><h2 id=环境>环境</h2><ul><li>Istio 版本: 1.0.2</li><li><code>K8s</code> 版本:<code>1.10.5_1517</code></li><li>Acmeair 应用4 个服务(每个服务一个实例),跨服务事务,外部 MongoDB平均载荷620 字节。</li></ul><h2 id=结果>结果</h2><p>使用 <code>Jmeter</code> 来生成负载,负载包含了一组持续五分钟的访问,每个阶段都会逐步提高客户端数量来发出 http 请求。客户端数量为1、5、10、20、30、40、50 和 60。</p><h3 id=吞吐量>吞吐量</h3><p>下图展示了不同案例中的吞吐量:</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:54.29638854296388%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./throughput3.png title=不同案例中的吞吐量><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./throughput3.png alt=不同案例中的吞吐量></a></div><figcaption>不同案例中的吞吐量</figcaption></figure><p>如图可见,在应用和外部数据库中加入 Sidecar 和 Egress gateway 并没有对性能产生太大影响;但是启用双向 TLS、又加入 SNI 代理之后,吞吐量分别下降了 10% 和 24%。</p><h3 id=响应时间>响应时间</h3><p>在 20 客户端的情况下我们对不同请求的平均响应时间也进行了记录。下图展示了各个案例中平均、中位数、90%、95% 以及 99% 百分位的响应时间。</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:48.76783398184176%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./response_times3.png title=不同配置中的响应时间><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./response_times3.png alt=不同配置中的响应时间></a></div><figcaption>不同配置中的响应时间</figcaption></figure><p>跟吞吐量类似,前面三个案例的响应时间没有很大区别,但是双向 TLS 和 额外的代理造成了明显的延迟。</p><h3 id=cpu-用量>CPU 用量</h3><p>运行过程中还搜集了所有 Istio 组件以及 Sidecar 的 CPU 使用情况。为了公平起见,用吞吐量对 Istio 的 CPU 用量进行了归一化。下图中展示了这一结果:</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:53.96174863387978%><a data-skipendnotes=true href=/v1.2/blog/2019/egress-performance/./cpu_usage3.png title="使用 TPS 进行归一化的 CPU 用量"><img class=element-to-stretch src=/v1.2/blog/2019/egress-performance/./cpu_usage3.png alt="使用 TPS 进行归一化的 CPU 用量"></a></div><figcaption>使用 TPS 进行归一化的 CPU 用量</figcaption></figure><p>经过归一化处理之后的 CPU 用量数据表明Istio 在使用 Egress gateway + SNI 代理的情况下,消耗了更多的 CPU。</p><h2 id=结论>结论</h2><p>在这一系列的测试之中,我们用不同的方式来访问一个启用了 TLS 的 MongoDB 来进行性能对比。Egress gateway 的引用没有对性能和 CPU 消耗的显著影响。但是启用了 Sidecar 和 Egress gateway 之间的双向 TLS 或者为通配符域名使用了额外的 SNI 代理之后,会看到性能降级的现象。</p><nav id=see-also><h2>相关内容</h2><div class=see-also><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a></p><p class=desc>描述了一个基于 Istio 的 Bookinfo 示例的简单场景。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2018/egress-monitoring-access-control/>HTTP Egress 流量监控和访问策略</a></p><p class=desc>描述如何配置 Istio 进行 HTTP Egress 流量监控和访问策略。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2018/egress-tcp/>使用外部 TCP 服务</a></p><p class=desc>描述基于 Istio 的 Bookinfo 示例的简单场景。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2018/egress-https/>使用外部 Web 服务</a></p><p class=desc>描述基于 Istio Bookinfo 示例的简单场景。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/docs/tasks/traffic-management/edge-traffic/egress_sni_monitoring_and_policies/>Egress TLS 流量中的 SNI 监控及策略</a></p><p class=desc>如何为 Egress TLS 流量配置 SNI 监控并应用策略。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/docs/tasks/traffic-management/edge-traffic/egress-gateway-tls-origination/>Egress 网关的 TLS 发起过程</a></p><p class=desc>描述了配置 Egress 网关来发起对外部服务进行 TLS 通信的过程。</p></div></div></nav></article><nav class=pagenav><div class=left><a title=宣布新的博客策略。 href=/v1.2/zh/blog/2019/sail-the-blog/><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#left-arrow"/></svg>博客策略更新</a></div><div class=right><a title="Istio 将数据面组件注入到现存部署之中的过程。" href=/v1.2/zh/blog/2019/data-plane-setup/>Istio Sidecar 注入过程解密<svg class="icon"><use xlink:href="/v1.2/img/icons.svg#right-arrow"/></svg></a></div></nav><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="Egress 流量案例"><a href=#egress-%e6%b5%81%e9%87%8f%e6%a1%88%e4%be%8b>Egress 流量案例</a><ol><li role=none aria-label="案例 1绕过 Sidecar"><a href=#%e6%a1%88%e4%be%8b-1-%e7%bb%95%e8%bf%87-sidecar>案例 1绕过 Sidecar</a><li role=none aria-label="案例 2使用 Service Entry通过 Sidecar 完成访问"><a href=#%e6%a1%88%e4%be%8b-2-%e4%bd%bf%e7%94%a8-service-entry-%e9%80%9a%e8%bf%87-sidecar-%e5%ae%8c%e6%88%90%e8%ae%bf%e9%97%ae>案例 2使用 Service Entry通过 Sidecar 完成访问</a><li role=none aria-label="案例 3: Egress gateway"><a href=#%e6%a1%88%e4%be%8b-3-egress-gateway>案例 3: Egress gateway</a><li role=none aria-label="案例 4在 Sidecar 和 Egress gateway 之间的双向 TLS"><a href=#%e6%a1%88%e4%be%8b-4-%e5%9c%a8-sidecar-%e5%92%8c-egress-gateway-%e4%b9%8b%e9%97%b4%e7%9a%84%e5%8f%8c%e5%90%91-tls>案例 4在 Sidecar 和 Egress gateway 之间的双向 TLS</a><li role=none aria-label="案例 5带有 SNI proxy 的 Egress gateway"><a href=#%e6%a1%88%e4%be%8b-5-%e5%b8%a6%e6%9c%89-sni-proxy-%e7%9a%84-egress-gateway>案例 5带有 SNI proxy 的 Egress gateway</a></ol></li><li role=none aria-label=环境><a href=#%e7%8e%af%e5%a2%83>环境</a><li role=none aria-label=结果><a href=#%e7%bb%93%e6%9e%9c>结果</a><ol><li role=none aria-label=吞吐量><a href=#%e5%90%9e%e5%90%90%e9%87%8f>吞吐量</a><li role=none aria-label=响应时间><a href=#%e5%93%8d%e5%ba%94%e6%97%b6%e9%97%b4>响应时间</a><li role=none aria-label="CPU 用量"><a href=#cpu-%e7%94%a8%e9%87%8f>CPU 用量</a></ol></li><li role=none aria-label=结论><a href=#%e7%bb%93%e8%ae%ba>结论</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="Go download Istio 1.2.5 now" href=https://github.com/istio/istio/releases/tag/1.2.5 aria-label="Download Istio"><span>download</span><svg class="icon"><use xlink:href="/v1.2/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.2/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.2/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.2/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.2/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
1.2.5<br>&copy; 2019 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2019年9月12日</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.2/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.2/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.2/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.2/img/icons.svg#top"/></svg></button></div></body></html>