istio.io/archive/v1.8/zh/blog/2019/performance-best-practices/index.html

28 lines
40 KiB
HTML
Raw 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="最佳实践Service Mesh 基准性能测试"><meta name=description content="评估 Istio 数据平面性能的工具和指南。"><meta name=author content="Megan O'Keefe (Google), John Howard (Google), Mandar Jog (Google)"><meta name=keywords content="microservices,services,mesh,performance,scalability,scale,benchmarks"><meta property="og:title" content="最佳实践Service Mesh 基准性能测试"><meta property="og:type" content="website"><meta property="og:description" content="评估 Istio 数据平面性能的工具和指南。"><meta property="og:url" content="/v1.8/zh/blog/2019/performance-best-practices/"><meta property="og:image" content="/v1.8/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.8 / 最佳实践Service Mesh 基准性能测试</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.8/blog/feed.xml><link rel=alternate type=application/rss+xml title="Istio News" href=/v1.8/news/feed.xml><link rel=alternate type=application/rss+xml title="Istio Blog and News" href=/v1.8/feed.xml><link rel="shortcut icon" href=/v1.8/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.8/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.8/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.8/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.8/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.8/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.8/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.8/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.8/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.8/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.8/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.8/css/all.css><script src=/v1.8/js/themes_init.min.js></script></head><body class="language-unknown archive-site"><script>const branchName="release-1.8";const docTitle="最佳实践Service Mesh 基准性能测试";const iconFile="\/v1.8/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.8/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.8/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.8</span></a><div id=hamburger><svg class="icon hamburger"><use xlink:href="/v1.8/img/icons.svg#hamburger"/></svg></div><div id=header-links><a title="了解如何部署、使用和运维 Istio。" href=/v1.8/zh/docs/>文档</a>
<a class=current title="关于使用 Istio 的博客文章。" href=/v1.8/zh/blog/2020/>博客<i class=dot data-prefix=/blog></i></a>
<a title="关于 Istio 项目的最新报道。" href=/v1.8/zh/news/>新闻<i class=dot data-prefix=/news></i></a>
<a title="关于 Istio 的常见问题。" href=/v1.8/zh/faq/>FAQ</a>
<a title="关于 Istio 项目的说明。" href=/v1.8/zh/about/>关于</a><div class=menu><button id=gearDropdownButton class=menu-trigger title=选项和设置 aria-label="Options and Settings" aria-controls=gearDropdownContent><svg class="icon gear"><use xlink:href="/v1.8/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\/performance-best-practices\/');return false;">当前版本</a>
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/blog\/2019\/performance-best-practices\/');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 magnifier"><use xlink:href="/v1.8/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.8/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 cancel-x"><use xlink:href="/v1.8/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 blog"><use xlink:href="/v1.8/img/icons.svg#blog"/></svg>2020 年的博客文章</button><div class=body 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 的另一个 Sidecar 代理。 (2020年7月29日)" href=/v1.8/zh/blog/2020/mosn-proxy/>在 Istio 中使用 MOSN另一个数据平面</a></li><li role=none><a role=treeitem title="Istiod 将 Istio 控制平面组件合并为一个二进制文件。 (2020年3月19日)" href=/v1.8/zh/blog/2020/istiod/>介绍 istiod简化控制平面</a></li><li role=none><a role=treeitem title="以声明方式为 Envoy 和 Istio 配置 Wasm 扩展。 (2020年3月16日)" href=/v1.8/zh/blog/2020/deploy-wasm-declarative/>在 Istio 中进行 WebAssembly 声明式部署</a></li><li role=none><a role=treeitem title="Istio 的扩展中使用 WASM 的前景。 (2020年3月5日)" href=/v1.8/zh/blog/2020/wasm-announce/>重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly</a></li><li role=none><a role=treeitem title="Istio 在 2020 年的愿景声明及路线图。 (2020年3月3日)" href=/v1.8/zh/blog/2020/tradewinds-2020/>Istio 2020——为了商用</a></li><li role=none><a role=treeitem title="一种更安全的秘密管理方式。 (2020年2月20日)" href=/v1.8/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.8/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 blog"><use xlink:href="/v1.8/img/icons.svg#blog"/></svg>2019 年的博客文章</button><div class="body default" 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 配置来发现潜在问题和一般问题。 (2019年11月14日)" href=/v1.8/zh/blog/2019/introducing-istioctl-analyze/>istioctl analyze 介绍</a></li><li role=none><a role=treeitem title="一种更安全管理 Istio webhook 的方法。 (2019年11月14日)" href=/v1.8/zh/blog/2019/webhook/>安全管理 Webhook</a></li><li role=none><a role=treeitem title="正式启用访问 Istio 资源。 (2019年11月14日)" href=/v1.8/zh/blog/2019/announcing-istio-client-go/>Istio client-go 发布公告</a></li><li role=none><a role=treeitem title="Istio v1beta1 授权策略的设计原则、基本概述及迁移操作。 (2019年11月14日)" href=/v1.8/zh/blog/2019/v1beta1-authorization-policy/>Istio v1beta1 授权策略概述</a></li><li role=none><a role=treeitem title="在 Istio 中配置和管理 DNS 证书。 (2019年11月14日)" href=/v1.8/zh/blog/2019/dns-cert/>DNS 证书管理</a></li><li role=none><a role=treeitem title="关于 Istio 基于 operator 的安装和控制平面管理特性的介绍。 (2019年11月14日)" href=/v1.8/zh/blog/2019/introducing-istio-operator/>Istio Operator 简介</a></li><li role=none><a role=treeitem title="把 Istio 入口网关配置为外部服务的代理。 (2019年10月15日)" href=/v1.8/zh/blog/2019/proxy/>把 Istio 作为外部服务的代理</a></li><li role=none><a role=treeitem title="将需要隔离的环境部署到单独的网格中,并通过网格联邦启用网格间通信。 (2019年10月2日)" href=/v1.8/zh/blog/2019/isolated-clusters/>用于隔离和边界保护的多网格部署</a></li><li role=none><a role=treeitem title="如何使用 Istio 去监控被阻止的和透传的外部服务流量。 (2019年9月28日)" href=/v1.8/zh/blog/2019/monitoring-external-service-traffic/>监控被阻止的和透传的外部服务流量</a></li><li role=none><a role=treeitem title="使用 Istio 实现零代码改动保护多云 Kubernetes 应用。 (2019年9月18日)" href=/v1.8/zh/blog/2019/app-identity-and-access-adapter/>APP 身份和访问适配器</a></li><li role=none><a role=treeitem title="本文演示 Mixer 进程外适配器实现 Knative scale-from-zero 逻辑的具体过程。 (2019年9月18日)" href=/v1.8/zh/blog/2019/knative-activator-adapter/>适用于 Knative 的 Mixer 适配器</a></li><li role=none><a role=treeitem title="利用 Kubernetes 可信任的 JWT 来更安全地为工作负载实例颁发证书。 (2019年9月10日)" href=/v1.8/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.8/zh/blog/2019/evolving-istios-apis/>Istio API 的演变</a></li><li role=none><a role=treeitem title="管控出口流量的备选方案比较,包括性能因素。 (2019年7月22日)" href=/v1.8/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.8/zh/blog/2019/egress-traffic-control-in-istio-part-2/>Istio 中的安全管控出口流量,第二部分</a></li><li role=none><span role=treeitem class=current title="评估 Istio 数据平面性能的工具和指南。 (2019年7月9日)">最佳实践Service Mesh 基准性能测试</span></li><li role=none><a role=treeitem title="了解如何延长 Istio 自签名根证书的有效期。 (2019年6月7日)" href=/v1.8/zh/blog/2019/root-transition/>延长 Istio 自签名根证书的有效期</a></li><li role=none><a role=treeitem title="涉及出口流量攻击和出口流量管控要求。 (2019年5月22日)" href=/v1.8/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.8/zh/blog/2019/istio1.1_perf/>为性能而设计的 Istio 1.1</a></li><li role=none><a role=treeitem title="在多集群服务网格环境中配置 Istio 的路由规则。 (2019年2月7日)" href=/v1.8/zh/blog/2019/multicluster-version-routing/>多集群服务网格中的分版本路由</a></li><li role=none><a role=treeitem title="宣布新的博客策略。 (2019年2月5日)" href=/v1.8/zh/blog/2019/sail-the-blog/>博客策略更新!</a></li><li role=none><a role=treeitem title="评估加入 Egress gateway 对性能造成的影响。 (2019年1月31日)" href=/v1.8/zh/blog/2019/egress-performance/>Egress gateway 性能测试</a></li><li role=none><a role=treeitem title="揭秘 Istio 是如何将其数据平面组件添加到现有 deployment。 (2019年1月31日)" href=/v1.8/zh/blog/2019/data-plane-setup/>揭开 Istio Sidecar 注入模型的神秘面纱</a></li><li role=none><a role=treeitem title="使用 AppSwitch 解决应用程序启动顺序和启动延迟。 (2019年1月14日)" href=/v1.8/zh/blog/2019/appswitch/>使用 AppSwitch 进行 Sidestepping 依赖性排序</a></li><li role=none><a role=treeitem title="Istio 有了一个新的论坛。 (2019年1月10日)" href=/v1.8/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.8/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 blog"><use xlink:href="/v1.8/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.8/zh/blog/2018/incremental-traffic-management/>增量式应用 Istio 第一部分,流量管理</a></li><li role=none><a role=treeitem title="描述了一个基于 Istio 的 Bookinfo 示例的简单场景。 (2018年11月16日)" href=/v1.8/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a></li><li role=none><a role=treeitem title="Istio 在 Twitch 举办了为期一天的直播庆祝 1.0 的发布。 (2018年8月3日)" href=/v1.8/zh/blog/2018/istio-twitch-stream/>Istio 在 Twitch 上全天直播</a></li><li role=none><a role=treeitem title="惠普如何在 Istio 上构建其下一代鞋类个性化平台。 (2018年7月31日)" href=/v1.8/zh/blog/2018/hp/>Istio 是惠普 FitStation 平台的改变者</a></li><li role=none><a role=treeitem title="使用 AppSwitch 自动接入应用并降低延迟。 (2018年7月30日)" href=/v1.8/zh/blog/2018/delayering-istio/>使用 AppSwitch 精简 Istio 层次</a></li><li role=none><a role=treeitem title="描述 Istio 的授权功能以及如何在各种用例中使用它。 (2018年7月20日)" href=/v1.8/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.8/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.8/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.8/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.8/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.8/zh/blog/2018/soft-multitenancy/>Istio 的软性多租户支持</a></li><li role=none><a role=treeitem title="介绍更安全,低风险的部署和发布到生产。 (2018年2月8日)" href=/v1.8/zh/blog/2018/traffic-mirroring/>用于在生产环境进行测试的 Istio 流量镜像功能</a></li><li role=none><a role=treeitem title="描述基于 Istio 的 Bookinfo 示例的简单场景。 (2018年2月6日)" href=/v1.8/zh/blog/2018/egress-tcp/>使用外部 TCP 服务</a></li><li role=none><a role=treeitem title="描述基于 Istio Bookinfo 示例的简单场景。 (2018年1月31日)" href=/v1.8/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 blog"><use xlink:href="/v1.8/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.8/zh/blog/2017/mixer-spof-myth/>Mixer 和 SPOF 神话</a></li><li role=none><a role=treeitem title="概要说明 Mixer 的插件架构。 (2017年11月3日)" href=/v1.8/zh/blog/2017/adapter-model/>Mixer 适配器模型</a></li><li role=none><a role=treeitem title="Istio 的策略如何关联 Kubernetes 的网络策略 。 (2017年8月10日)" href=/v1.8/zh/blog/2017/0.1-using-network-policy/>Istio 使用网络策略</a></li><li role=none><a role=treeitem title="使用 Istio 创建自动缩放的金丝雀部署。 (2017年6月14日)" href=/v1.8/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.8/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 pull"><use xlink:href="/v1.8/img/icons.svg#pull"/></svg></button><nav aria-label=Breadcrumb><ol><li><a href=/v1.8/zh/ title=用于连接、保护、控制和观测服务。>Istio</a></li><li><a href=/v1.8/zh/blog/ title="关于使用 Istio 的博客文章。">博客</a></li><li><a href=/v1.8/zh/blog/2019/ title="2019 年的博客文章。">2019 年的博客文章</a></li><li>最佳实践Service Mesh 基准性能测试</li></ol></nav><article aria-labelledby=title><div class=title-area><div style=width:100%><h1 id=title>最佳实践Service Mesh 基准性能测试</h1><p class=byline><span>作者</span>
<span class=attribution>Megan O'Keefe (Google), John Howard (Google), Mandar Jog (Google)</span><span> | </span><span><svg class="icon calendar"><use xlink:href="/v1.8/img/icons.svg#calendar"/></svg><span>&nbsp;</span>2019年7月9日<span>&nbsp;</span>(更新于 2019年9月5日</span><span> | </span><span title="317 字"><svg class="icon clock"><use xlink:href="/v1.8/img/icons.svg#clock"/></svg><span>&nbsp;</span>阅读大约需要 2 分钟</span>
<span>&nbsp;</span>
<span></span></p></div></div><nav class=toc-inlined aria-label="Table of Contents"><div><hr><ol><li role=none aria-label="1. 使用生产就绪的 Istio 安装"><a href=#1-use-a-production-ready-Istio-installation>1. 使用生产就绪的 Istio 安装</a><li role=none aria-label="2. 专注于数据平面"><a href=#2-focus-on-the-data-plane>2. 专注于数据平面</a><li role=none aria-label="3. 有/无 度量的代理"><a href=#3-measure-with-and-without-proxies>3. 有/无 度量的代理</a><li role=none aria-label="Istio 1.2 性能"><a href=#Istio-1-2-performance>Istio 1.2 性能</a><li role=none aria-label=总结><a href=#summary>总结</a><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol><hr></div></nav><p>服务网格为应用部署增加了很多功能,包括<a href=/v1.8/zh/docs/concepts/what-is-istio/#traffic-management>流量策略</a><a href=/v1.8/zh/docs/concepts/what-is-istio/#observability>可观察性</a><a href=/v1.8/zh/docs/concepts/what-is-istio/#security>安全通信</a>。但是无论是时间增加的延迟还是资源CPU 周期),向环境中添加服务网格都是有代价的。要就服务网格是否适合您的情况做出明智的决定,评估应用与服务网格一起部署时的性能非常重要。</p><p>今年早些时候,我们发布了关于 Istio 1.1 性能改进的<a href=/v1.8/zh/blog/2019/istio1.1_perf/>博客</a>。在发布 <a href=/v1.8/zh/news/releases/1.2.x/announcing-1.2>Istio 1.2</a> 之后,我们希望提供指导和工具,以帮助您在可用于生产的 Kubernetes 环境中对 Istio 的数据平面性能进行基准测试。</p><p>总体而言,我们发现 Istio <a href=/v1.8/zh/docs/ops/deployment/architecture/#envoy>sidecar 代理</a>的延迟取决于并发连接数。以每秒 1000 个请求RPS的速度通过 16 个连接Istio 延迟在 50% 时增加 <strong>3 毫秒</strong>,在 99% 时增加 <strong>10 毫秒</strong></p><p><a href=https://github.com/istio/tools/tree/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/benchmark>Istio Tools 仓库</a>中,您将找到用于测量 Istio 数据平面性能的脚本和说明,以及有关如何使用另一服务网格实现 <a href=https://linkerd.io>Linkerd</a> 运行脚本的其他说明。在我们详细介绍性能测试框架的每个步骤的一些最佳实践时,请<a href=https://github.com/istio/tools/tree/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/benchmark#setup>遵循</a></p><h2 id=1-use-a-production-ready-Istio-installation>1. 使用生产就绪的 Istio 安装</h2><p>为了准确地大规模度量服务网格的性能,使用<a href=https://github.com/istio/tools/tree/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/istio-install#istio-setup>适当大小的</a> Kubernetes 集群很重要。我们使用三个工作节点进行测试,每个工作节点至少具有 4 vCPU 和 15 GB 的内存。</p><p>然后,在该群集上使用可用于生产的 Istio <strong>安装配置文件</strong> 很重要。这使我们能够实现面向性能的设置,例如控制平面 pod 自动伸缩,并确保资源限制适用于繁重的流量负荷。<a href=/v1.8/zh/docs/setup/install/helm/#安装步骤>默认</a> Istio 安装适用于大多数基准测试用例。为了进行广泛的性能基准测试,并提供数千种注入代理的服务,我们还提供了<a href=https://github.com/istio/tools/blob/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/istio-install/values.yaml>调整后的 Istio 安装</a>,可为 Istio 控制平面分配额外的内存和 CPU。</p><p><svg class="large-icon"><use xlink:href="/v1.8/img/icons.svg#exclamation-mark"/></svg>Istio 的 <a href=/v1.8/zh/docs/setup/getting-started/>demo 安装</a>不适合进行性能测试,因为它被设计为部署在小型试用群集中,并且具有完整的跟踪和访问日志,可显示 Istio 的功能。</p><h2 id=2-focus-on-the-data-plane>2. 专注于数据平面</h2><p>我们的基准测试脚本专注于评估 Istio 数据平面:<span class=term data-title=Envoy data-body='<p>Envoy 是在 Istio 里使用的高性能代理,用于为所有<a href="/zh/docs/reference/glossary/#service-mesh">服务网格</a>里的<a href="/zh/docs/reference/glossary/#service">服务</a>调度进出的流量。
<a href="https://envoyproxy.github.io/envoy/">了解更多关于 Envoy</a>。</p>'>Envoy</span> 代理,可在应用容器之间进行流量调度。为什么要关注数据平面?因为在大规模使用大量应用容器时,数据平面的 <strong>内存</strong><strong>CPU</strong> 使用率很快就会超过 Istio 控制平面。让我们看一个具体的例子:</p><p>假设您运行了 2,000 个注入 Envoy 的 pod每个 pod 每秒处理 1,000 个请求。每个代理使用 50 MB 的内存并且要配置所有这些代理Pilot 使用 1 vCPU 和 1.5 GB 的内存。所有的资源中Istio 数据平面(所有 Envoy 代理的总和)使用了 100 GB 的内存,而 Pilot 只使用了 1.5 GB。</p><p>考虑到 <strong>延迟</strong>,关注数据平面性能也很重要。这是因为大多数应用的请求会通过 Istio 数据平面,而不是通过控制平面。但是,有两个例外:</p><ol><li><strong>遥测报告:</strong> 每个代理将原始遥测数据发送到 <span class=term data-title=Mixer data-body='<p>Mixer 是 Istio 里的一个组件,它负责增强<a href="/zh/docs/reference/glossary/#service-mesh">服务网格</a>里的访问控制和使用策略。它还负责收集来自 <a href="/zh/docs/reference/glossary/#envoy">envoy</a> 和其他服务的遥测数据。
<a href="/zh/docs/reference/config/policy-and-telemetry">了解更多关于 Mixer</a>。</p>'>Mixer</span>Mixer 将其处理为度量,跟踪和其他遥测。原始遥测数据类似于访问日志,因此要付出一定的代价。访问日志处理会消耗 CPU并使工作线程无法处理下一个工作单元。在更高的吞吐量场景下下一个工作单元更有可能在队列中等待被工作者接走。这可能导致 Envoy 的长尾延迟99%)。</li><li><strong>自定义策略检查:</strong> 当使用<a href=/v1.8/zh/docs/concepts/observability/>自定义 Istio 策略适配器</a>时,策略检查位于请求路径上。这意味着数据路径上的请求 header 和 metadata 将被发送到控制平面Mixer从而导致更高的请求延迟。<strong>注意:</strong> 这些策略检查<a href=/v1.8/zh/docs/reference/config/installation-options/#global-options>默认情况下处于禁用状态</a>,因为最常见的策略用例(<a href=/v1.8/zh/docs/reference/config/security/istio.rbac.v1alpha1>RBAC</a>)完全由 Envoy 代理执行。</li></ol><p><a href=https://docs.google.com/document/d/1QKmtem5jU_2F3Lh5SqLp0IuPb80_70J7aJEYu4_gS-s>Mixer V2</a> 将所有策略和遥测功能直接移到代理中时,这两个例外都会在将来的 Istio 版本中消失。</p><p>接下来,在大规模测试 Istio 的数据平面性能时,不仅要以每秒递增的请求进行测试,而且还要以越来越多的 <strong>并发</strong> 连接进行测试,这一点很重要。这是因为现实世界中的高吞吐量流量来自多个客户端。我们<a href=https://github.com/istio/tools/tree/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/benchmark#run-performance-tests>提供了脚本</a>允许您以递增的 RPS 对任意数量的并发连接执行相同的负载测试。</p><p>最后,我们的测试环境可以测量两个 pod 之间少量的请求。客户端 pod 是 <a href=http://fortio.org/>Fortio</a>,它将流量发送到服务端 pod。</p><p>为什么只用两个 pod 测试因为增加吞吐量RPS和连接线程对 Envoy 的性能的影响比增加服务注册表的总大小(或 Kubernetes 集群中 Pod 和服务的总数更大。当服务注册表的大小增加时Envoy 必须跟踪更多的端点,并且每个请求的查找时间确实增加了,但是增加了一个很小的常数。如果您有许多服务,并且此常数成为延迟问题,则 Istio 提供 <a href=/v1.8/zh/docs/reference/config/networking/sidecar/>Sidecar 资源</a>,它使您可以限制每个 Envoy 知道的服务。</p><h2 id=3-measure-with-and-without-proxies>3. 有/无 度量的代理</h2><p>尽管 Istio 的许多特性,例如<a href=/v1.8/zh/docs/concepts/security/#mutual-TLS-authentication>双向 TLS 身份验证</a>,都依赖于应用 pod 的 Envoy 代理,但是您可以<a href=/v1.8/zh/docs/setup/additional-setup/sidecar-injection/#disabling-or-updating-the-webhook>选择性地禁用</a>一些网格服务的 sidecar 代理注入。在扩展 Istio 以进行生产时,您可能需要将 sidecar 代理增量添加到工作负载中。</p><p>为此,测试脚本提供了<a href=https://github.com/istio/tools/tree/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/benchmark#run-performance-tests>三种不同模式</a>。当请求同时通过客户端和服务器代理(<code>both</code>)、仅通过服务器代理(<code>serveronly</code>)和都不通过代理(<code>baseline</code>)时,这些模式将分析 Istio 的性能。</p><p>您还可以在性能测试期间禁用 <a href=/v1.8/zh/docs/concepts/observability/>Mixer</a> 以停止 Istio 的遥测,这将得到与 Mixer V2 工作完成时我们期望的性能相符的结果。Istio 还支持 <a href=https://github.com/istio/istio/wiki/Envoy-native-telemetry>Envoy 本地遥测</a>,其功能类似于禁用 Istio 的遥测。</p><h2 id=Istio-1-2-performance>Istio 1.2 性能</h2><p>让我们看看如何使用该测试环境来分析 Istio 1.2 数据平面的性能。我们还提供了运行 <a href=https://github.com/istio/tools/tree/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/benchmark/linkerd>Linkerd 数据平面的相同性能测试</a>的说明。Linkerd 目前仅支持延迟基准测试。</p><p>为了衡量 Istio sidecar 的代理延迟,我们考虑在 50%、90% 和 99% 时不断增加并发连接数量从而保持了请求吞吐量RPS不变。</p><p>我们发现,通过 16 个并发连接和 1000 RPS当请求同时通过客户端和服务器代理传输时Istio 会在基线P50上增加 <strong>3ms</strong>。(从绿色线 <code>both</code> 中减去粉红色线 <code>base</code>)在 64 个并发连接上Istio 在基线上增加了 <strong>12ms</strong>,但是禁用 Mixer<code>nomixer_both</code>Istio 仅增加了 <strong>7ms</strong></p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:60%><a data-skipendnotes=true href=/v1.8/zh/blog/2019/performance-best-practices/latency_p50.png title="Istio sidecar 代理, 50% 时的延迟"><img class=element-to-stretch src=/v1.8/zh/blog/2019/performance-best-practices/latency_p50.png alt="Istio sidecar 代理, 50% 时的延迟"></a></div><figcaption></figcaption></figure><p>在 90% 时,有 16 个并发连接Istio 增加 <strong>6ms</strong>;在 64 个连接的情况下Istio 增加了 <strong>20ms</strong></p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:60%><a data-skipendnotes=true href=/v1.8/zh/blog/2019/performance-best-practices/latency_p90.png title="Istio sidecar 代理, 90% 时的延迟"><img class=element-to-stretch src=/v1.8/zh/blog/2019/performance-best-practices/latency_p90.png alt="Istio sidecar 代理, 90% 时的延迟"></a></div><figcaption></figcaption></figure><p>最后,在具有 16 个连接的 99% 时Istio 在基线之上增加了 <strong>10ms</strong>。在 64 个连接处Istio 使用 Mixer 增加 <strong>25ms</strong>,不使用 Mixer 则增加 <strong>10ms</strong></p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:60%><a data-skipendnotes=true href=/v1.8/zh/blog/2019/performance-best-practices/latency_p99.png title="Istio sidecar 代理, 99% 时的延迟"><img class=element-to-stretch src=/v1.8/zh/blog/2019/performance-best-practices/latency_p99.png alt="Istio sidecar 代理, 99% 时的延迟"></a></div><figcaption></figcaption></figure><p>对于 CPU 使用率我们以不断增加的请求吞吐量RPS和恒定数量的并发连接进行了测量。我们发现启用了 Mixer 的 Envoy 在 3000 RPS 时的最大 CPU 使用率是 <strong>1.2 vCPU</strong>。在 1000 RPS 时,一个 Envoy 大约使用了 50% 的 CPU。</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:60%><a data-skipendnotes=true href=/v1.8/zh/blog/2019/performance-best-practices/cpu_max.png title="Istio sidecar 代理,最大 CPU 使用率"><img class=element-to-stretch src=/v1.8/zh/blog/2019/performance-best-practices/cpu_max.png alt="Istio sidecar 代理,最大 CPU 使用率"></a></div><figcaption></figcaption></figure><h2 id=summary>总结</h2><p>在对 Istio 的性能进行基准测试的过程中,我们吸取了一些重要的经验教训:</p><ul><li>使用模仿生产的环境。</li><li>专注于数据平面流量。</li><li>基于基准进行测量。</li><li>增加并发连接以及总吞吐量。</li></ul><p>对于在 16 个连接上具有 1000 RPS 的网格Istio 1.2 仅在 50% 的基础上增加了 <strong>3 毫秒</strong> 的基准延迟。</p><div><aside class="callout tip"><div class=type><svg class="large-icon"><use xlink:href="/v1.8/img/icons.svg#callout-tip"/></svg></div><div class=content>Istio 的性能取决于您的具体设置和流量负载情况。由于存在这种差异,请确保您的测试设置能够准确反映您的生产工作负载。要试用基准测试脚本,请转到 <a href=https://github.com/istio/tools/tree/3ac7ab40db8a0d595b71f47b8ba246763ecd6213/perf/benchmark>Istio Tools 库</a></div></aside></div><p>另外,请查阅 <a href=/v1.8/zh/docs/ops/deployment/performance-and-scalability>Istio 性能和可伸缩性指南</a>获取最新的性能数据。感谢您的阅读,祝您基准测试愉快!</p><nav id=see-also><h2>相关内容</h2><div class=see-also><div class=entry><p class=link><a data-skipendnotes=true href=/v1.8/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.8/zh/docs/ops/deployment/performance-and-scalability/>性能和可扩展性</a></p><p class=desc>介绍 Istio 的性能和可扩展性。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.8/zh/blog/2020/wasm-announce/>重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly</a></p><p class=desc>Istio 的扩展中使用 WASM 的前景。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.8/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.8/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.8/zh/blog/2019/appswitch/>使用 AppSwitch 进行 Sidestepping 依赖性排序</a></p><p class=desc>使用 AppSwitch 解决应用程序启动顺序和启动延迟。</p></div></div></nav></article><nav class=pagenav><div class=left><a title="使用 Istio 的出口流量管控来阻止相关出口流量攻击。" href=/v1.8/zh/blog/2019/egress-traffic-control-in-istio-part-2/><svg class="icon left-arrow"><use xlink:href="/v1.8/img/icons.svg#left-arrow"/></svg>Istio 中的安全管控出口流量,第二部分</a></div><div class=right><a title="了解如何延长 Istio 自签名根证书的有效期。" href=/v1.8/zh/blog/2019/root-transition/>延长 Istio 自签名根证书的有效期<svg class="icon right-arrow"><use xlink:href="/v1.8/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="1. 使用生产就绪的 Istio 安装"><a href=#1-use-a-production-ready-Istio-installation>1. 使用生产就绪的 Istio 安装</a><li role=none aria-label="2. 专注于数据平面"><a href=#2-focus-on-the-data-plane>2. 专注于数据平面</a><li role=none aria-label="3. 有/无 度量的代理"><a href=#3-measure-with-and-without-proxies>3. 有/无 度量的代理</a><li role=none aria-label="Istio 1.2 性能"><a href=#Istio-1-2-performance>Istio 1.2 性能</a><li role=none aria-label=总结><a href=#summary>总结</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.8.3" href=/v1.8/docs/setup/getting-started/#download aria-label="Download Istio"><span>download</span><svg class="icon download"><use xlink:href="/v1.8/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 discourse"><use xlink:href="/v1.8/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 stackoverflow"><use xlink:href="/v1.8/img/icons.svg#stackoverflow"/></svg></a>
<a class=channel title="在 Slack 上与 Istio 社区交互讨论开发问题(仅限邀请)" href=https://slack.istio.io aria-label=slack><span>slack</span><svg class="icon slack"><use xlink:href="/v1.8/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 twitter"><use xlink:href="/v1.8/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
1.8.3<br>&copy; 2020 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2021年2月9日</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 github"><use xlink:href="/v1.8/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 drive"><use xlink:href="/v1.8/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 working-groups"><use xlink:href="/v1.8/img/icons.svg#working-groups"/></svg></a><div class=tag>对于开发者</div></div></footer><script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js defer></script><div id=scroll-to-top-container aria-hidden=true><button id=scroll-to-top title=回到顶部><svg class="icon top"><use xlink:href="/v1.8/img/icons.svg#top"/></svg></button></div></body></html>