4lqedz 发表于 2024-8-31 05:46:25

WWDC:无线网络优化实践,带来哪些启发?

<img src="https://mmbiz.qpic.cn/mmbiz_gif/33P2FdAnjuibvP9dddsS0e17o8cux4FnUsATicoVYcdR7v42LhL80ErcU8W2RGN5WpicyMOQOVzOks7bCtCqNhZtw/640?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1" style="width: 50%; margin-bottom: 20px;">
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">网络技术<span style="color: black;">做为</span>互联网应用赖以存在的技术<span style="color: black;">基本</span>,速度与安全永远是其核心使命,<span style="color: black;">这次</span>WWDC的网络类topic涵盖内容基本还是围绕这两个点来展开。<span style="color: black;">这次</span>WWDC网络类session在<span style="color: black;">基本</span>网络技术上譬如新协议、新算法方面着墨并不多;<span style="color: black;">亦</span>未提出新的类似NSURLSession / Network.framework之类的新网络组件。站在应用视角,<span style="color: black;">这次</span>WWDC网络类session可分为两大类:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">无线网络体验优化实践在系统层面的标准化;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">本地网络应用的权限管控<span style="color: black;">加强</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在<span style="color: black;">第1</span>类议题中,<span style="color: black;">咱们</span>看到<span style="color: black;">非常多</span><span style="color: black;">已然</span>在手淘中的类似实践,或标准或自研,说明手淘在网络技术的<span style="color: black;">研发</span>与应用上还是较为深入和前沿的,基本走在<span style="color: black;">全世界</span>业界前列。<span style="color: black;">按照</span><span style="color: black;">咱们</span>手淘的业务特点,笔者重点关注<span style="color: black;">第1</span>类session,并简单探讨该新技术<span style="color: black;">能够</span><span style="color: black;">咱们</span>带来什么样启发和变化。</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">运用</span>加密DNS</span></strong></h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">DNS解析是网络的连接的<span style="color: black;">第1</span>步,<span style="color: black;">这儿</span><span style="color: black;">说到</span>的"加密DNS"是什么、它<span style="color: black;">处理</span>什么问</span><span style="color: black;">题?</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">处理</span>什么问题</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一是传统Local DNS的<span style="color: black;">查找</span>与回复均基于非加密UDP,<span style="color: black;">咱们</span><span style="color: black;">平常</span>的DNS劫持问题</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzgHtFx1XicCahsdtgnAcgZKJwuda02VicFN53Kpdibib8qV6K0SBFITqVpw/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">二是Local DNS Server本身不可信,<span style="color: black;">或</span>本地Local DNS 服务不可用。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnziaq4RBFP3ViajzPagmz2Jp3ryFX5nuU1Y4vQzFricHXdicR2Vz2erbobHQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">其实针对DNS解析过程中以上两个问题,在实践中早就有<span style="color: black;">认识</span>决<span style="color: black;">方法</span>,<span style="color: black;">便是</span>HTTPDNS, 各大云厂商<span style="color: black;">亦</span>都有成熟<span style="color: black;">制品</span>售卖,那苹果<span style="color: black;">这儿</span>的加密DNS与<span style="color: black;">咱们</span>的现有HTTPDNS有何<span style="color: black;">区别</span>呢?</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">现有HTTPDNS有两个很大的问题:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一是对业务的侵入性,即<span style="color: black;">倘若</span>某个网络连接需要<span style="color: black;">运用</span>HTTPDNS的能力,<span style="color: black;">首要</span>他需要集成服务商<span style="color: black;">供给</span>的SDK, 引入相应的Class,<span style="color: black;">而后</span>修改网络连接的<span style="color: black;">周期</span>的代码;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">二是面临<span style="color: black;">各样</span>技术坑,<span style="color: black;">例如</span>302场景的IP直连处理、WebView下IP直连<span style="color: black;">怎样</span>处理Cookie、以及iOS上的老大难的SNI问题等,这些都需要业务<span style="color: black;">研发</span>者付出<span style="color: black;">极重</span>的<span style="color: black;">奋斗</span>和尝试。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">iOS 14 上的 Encrypted DNS 功能很好的<span style="color: black;">处理</span>了现有HTTPDNS的存在的问题。</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">规范与标准</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">iOS 14 <span style="color: black;">起始</span>系统原生支持两种标准规范的 Encrypted DNS, 分别是 DNS over TLS 与 DNS over HTTPS.</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzMjibOd7ia2rodwpc2ls3AiajJVZibxx2PicUGRr7gJpNkAI6O8ftgocljMg/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">详细</span>协议标准<span style="color: black;">能够</span>参见:</span><span style="color: black;">rfc7858 (DoT)</span><span style="color: black;"> 、</span><span style="color: black;">rfc8484 (DoH)</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">怎样</span>实现</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">iOS 14 <span style="color: black;">供给</span>了两种设置加密DNS的<span style="color: black;">办法</span>。<span style="color: black;">第1</span>种方式是<span style="color: black;">选取</span>一个DNS服务器<span style="color: black;">做为</span>系统全局所有App默认的DNS解析器,<span style="color: black;">倘若</span>你<span style="color: black;">供给</span>的是一个公共DNS服务器,你<span style="color: black;">能够</span><span style="color: black;">运用</span>NEDNSSettingsManager API编写一个NetworkExtension App完成系统全局加密DNS设置。<span style="color: black;">或</span><span style="color: black;">倘若</span>你<span style="color: black;">运用</span>MDM(Mobile Device Management)管理设备的企业设置;你<span style="color: black;">能够</span>推送一个<span style="color: black;">包括</span>DNSSettings paload的profile文件完成加密DNS设置。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzsLotM4M0hzXbDA74yrQYlMlr8SQTsyXrwZerm96DWHpSv29kHL9nCw/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">运用</span>NetworkExtension设置系统域全局DNS服务器示例代码:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzee42uW7MvTsZuy3ic7bWPdKVunUiaw4bpLMbdptNFlZhDEdKMbDOQ7Vg/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">上述代码<span style="color: black;">首要</span><span style="color: black;">经过</span>NEDNSSettingsManager加载配置,加载成功后,创建一个基于DoH协议的NEDNSOverHTTPSSettings实例,对其配置DNS IP<span style="color: black;">位置</span>和域名,DNS IP<span style="color: black;">位置</span>是可选配置的。<span style="color: black;">而后</span>将NEDNSOverHTTPSSettings实例配置到NEDNSSettingsManager共享实例的dnsSettings属性,最后<span style="color: black;">保留</span>配置。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一条DNS配置<span style="color: black;">包含</span>DNS服务器<span style="color: black;">位置</span>、DoT/DoH协议、一组网络规则。网络规则<span style="color: black;">保证</span>DNS设置兼容<span style="color: black;">区别</span>的网络。<span style="color: black;">由于</span>公共DNS服务器是<span style="color: black;">没法</span>解析本地网络的私有域名,<span style="color: black;">例如</span><span style="color: black;">仅有</span>企业WiFi网络内的DNS服务器<span style="color: black;">能够</span>解析员工<span style="color: black;">拜访</span>的私有域名,这类<span style="color: black;">状况</span>就需要手动指定网络规则兼容企业WiFi网。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">网络规则<span style="color: black;">能够</span>针对<span style="color: black;">区别</span>网络类型定义<span style="color: black;">行径</span>,<span style="color: black;">例如</span>蜂窝网、WiFi、<span style="color: black;">或</span><span style="color: black;">详细</span>的WiFi SSID。在匹配的网络下,你<span style="color: black;">能够</span>禁用配置的全局DNS设置,<span style="color: black;">或</span>对私有域名不<span style="color: black;">运用</span>DNS设置。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">而在<span style="color: black;">有些</span><span style="color: black;">状况</span>下,兼容性会自动处理。<span style="color: black;">例如</span>强制门户网络(captive portal), 手机在连接上某个WiFi的时候,自<span style="color: black;">活动</span>出一个页面输入账号<span style="color: black;">秘码</span><span style="color: black;">才可</span>连接网络。这种<span style="color: black;">状况</span>下系统域全局DNS配置会做例外处理。相类似的,<span style="color: black;">针对</span>VPN网络,在VPN隧道内的解析将<span style="color: black;">运用</span>VPN的DNS设置,而不<span style="color: black;">运用</span>系统域DNS配置。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">网络规则设置示例代码:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzSUtcyCDEmTtGoxUqDn2IicTF1naRItQB1olTuBpPCMWubRmgqLS02icA/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">以上</span>代码设置了三个网络规则,<span style="color: black;">第1</span>个规则<span style="color: black;">暗示</span>DNS配置应该在SSID="MyWorkWiFi"的WiFi网络生效,但对私有企业域名enterprise.example.net不开启。第二个规则<span style="color: black;">暗示</span>规则在蜂窝网下应该被禁止<span style="color: black;">运用</span>;第三个NEOnDemandRuleConnect<span style="color: black;">暗示</span>DNS配置应该默认开启;<span style="color: black;">由于</span>配置DNS是系统支持的,<span style="color: black;">因此</span>在编写NetworkExtension App时不需要实现Extension程序,只需要在Network Extensions中勾选DNS Settings选项。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzx3geC8xJNIAyNGyGvUpIp2Kfp5eFQiaJc9zGDPiba7SceYmZZPYv2yBQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">运行NetworkExtension App,DNS配置将会被安装到系统,为了让DNS配置生效,需要前往设置-&gt;通用-&gt;VPN &amp; Network-&gt;DNS手动启用。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzuk1tlRxJs17fo4eNwqibiaH91re11WZVAgwpvaZQOWYf42ibAtPV6mrMg/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">有些</span>网络可能会<span style="color: black;">经过</span>策略阻止你<span style="color: black;">运用</span>加密的DNS服务器。这些网络尝试分析DNS<span style="color: black;">查找</span>请求来过滤流量。<span style="color: black;">针对</span>此类网络,系统会被标记隐私警告提示,在该网络下的网络连接将会失败。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzAiaUc9M93UZNZt5iahS12icDFhKhpWHuuKkI4ZAGTflOa9acJQdJVMQTA/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">第二种方式是针对单个App的所有连接或部分连接启用加密DNS。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzWseJxMCLlA4qreItkHI0oQBdHWljIVjnpiaqoyPcKGVpMdr8tVPuzRQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">倘若</span>你只想为你的App<span style="color: black;">运用</span>加密DNS,而非<span style="color: black;">触及</span><span style="color: black;">全部</span>系统域。你<span style="color: black;">能够</span>适配Network framework的PrivacyContext,对你的<span style="color: black;">全部</span>App开启加密DNS,<span style="color: black;">或</span>仅对某一连接开启。不管<span style="color: black;">运用</span>的是URLSessionTask,或Network framework连接或getaddrinfo的POSIX API,这种方式都有效。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">对单个连接<span style="color: black;">运用</span>加密DNS示例代码:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzIclPG2UcynWTO7zj2dCGEKbRkQtKHVMW1dP91d7N2LlOoI5vOypIFg/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">验证请求<span style="color: black;">是不是</span>使用加密DNS:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzNql558XtzRC02pTI4ibD5mNRyeUMaWTutEqmQX7ibVXrFQA5hx9plprQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">倘若</span>你想在App范围内<span style="color: black;">运用</span>加密DNS,你<span style="color: black;">能够</span>配置默认的PrivacyContext;App内发起的<span style="color: black;">每一个</span>DNS解析都会<span style="color: black;">运用</span>这个配置。不管是URLSessionTask,还是类似getaddrinfo的底层API。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzkTT9D8lj1p5sSjKUCydXYhLSERA7BOTZ840ibIBJvjcTibfz2jSrlL0w/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">现有实践对比及启发</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">与现有实践对比</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">上文<span style="color: black;">已然</span><span style="color: black;">说到</span>过HTTPDNS<span style="color: black;">制品</span>,手淘的域名解析,采用的是类似于HTTPDNS原理,但更加<span style="color: black;">繁杂</span>的调度<span style="color: black;">方法</span>。<span style="color: black;">然则</span>相比于这种系统层面的标准化<span style="color: black;">方法</span>,<span style="color: black;">处理</span>了现有实践中的两大<span style="color: black;">困难</span>:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">对业务的侵入性:业务必须修改现有网络连接的<span style="color: black;">周期</span>的代码;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">交互的标准兼容性不足:IP直连下的302问题、Cookie问题、SNI问题等
            &nbsp;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">带来的变化</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一是在应用内部,<span style="color: black;">咱们</span><span style="color: black;">能够</span>对业务透明<span style="color: black;">供给</span><span style="color: black;">供给</span>全局的域名调度<span style="color: black;">或</span>域名兜底解析能力, <span style="color: black;">再也不</span>是<span style="color: black;">仅有</span>用到特定组件或SDK才<span style="color: black;">能够</span>。二是苹果放开系统级别DNS接管后,用户设备上的服务相比原Local DNS的“中立性”<span style="color: black;">怎样</span>管控?对特定业务<span style="color: black;">是不是</span><span style="color: black;">乃至</span>会<span style="color: black;">导致</span>恶化?<span style="color: black;">倘若</span>对<span style="color: black;">外边</span>应用的这种“中立性”疑问或担心确实存在,则这种系统标准化的加密DNS对手淘这种大型应用则是必选项。</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;"><strong style="color: blue;"><span style="color: black;">受限网络中推送</span></strong></h1><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐</span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">&nbsp; <span style="color: black;">处理</span>什么问题</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">当向iOS设备推送<span style="color: black;">信息</span>时,业务服务器需要将<span style="color: black;">信息</span>先发送给APNS服务器,APNS服务器再将<span style="color: black;">信息</span>转换为<span style="color: black;">通告</span>payload推送给<span style="color: black;">目的</span>设备。<span style="color: black;">倘若</span>设备所在的WiFi网络<span style="color: black;">无</span>连接互联网<span style="color: black;">或</span>当前网络受限,<span style="color: black;">例如</span>在游艇、医院、野营地这些<span style="color: black;">地区</span>,设备<span style="color: black;">无</span>与APNS服务器<span style="color: black;">创立</span>有效连接,APNS<span style="color: black;">信息</span>投递将会失败。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzIwAD4MibW1YM45VHvFBEVom1WKTmBXeY8WKu9UrpwZFbdiasiaM6LOtqw/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">针对</span><span style="color: black;">有些</span>App<span style="color: black;">来讲</span>,接收推送<span style="color: black;">信息</span>是App的一项非常重要的功能,即使在<span style="color: black;">无</span>互联网连接的<span style="color: black;">状况</span>下<span style="color: black;">亦</span>需要<span style="color: black;">连续</span>稳定工作。为了满足这一<span style="color: black;">需要</span>,iOS 14中<span style="color: black;">增多</span>了本地推送连接(Local Push Connectivity)API,这是NetworkExtension家族中新的API。本地推送连接API<span style="color: black;">准许</span><span style="color: black;">研发</span>者创建自己的推送连接服务,<span style="color: black;">经过</span><span style="color: black;">研发</span>一个App Extension,在指定的WiFi网络下<span style="color: black;">能够</span>直接与本地业务服务器通信。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzy9T9kDpOhLZcm32VA9aZEibMYZOTcfsVmp4FnjPlxK7J4ZDWT4ULlzQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">上图中,App Extension<span style="color: black;">重点</span>负责保持与本地业务服务器之间的连接,以及接收业务服务器发来的<span style="color: black;">通告</span>。<span style="color: black;">由于</span><span style="color: black;">无</span>了APNS,<span style="color: black;">研发</span>者需要为业务服务器与App Extension定义自己的通信协议。主App需要配置<span style="color: black;">详细</span>在哪个WiFi网络下<span style="color: black;">运用</span>本地推送连接。当App加入到指定的WiFi网络,系统会拉起App Extension, 并在后台<span style="color: black;">连续</span>运行。当App断开与指定WiFi网络的连接,系统将停止App Extension运行。</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">怎样</span>实现</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">本地推送连接对<span style="color: black;">哪些</span>推送功能非常重要,而设备所在网络受限的场景非常适合。而<span style="color: black;">针对</span>常规的推送<span style="color: black;">需要</span>,依然<span style="color: black;">举荐</span><span style="color: black;">运用</span>PushKit或UserNotification API处理APNS推送<span style="color: black;">信息</span>。每台设备和APNS服务器之间只<span style="color: black;">创立</span>一条APNS连接,设备上所有App都公用这一条连接,<span style="color: black;">因此</span>APNS非常省电。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">APNS与本地推送连接对比:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzJicBHVaMlPicJsNrbIpib8rjJ7d17FtXQEkAxxCTjoTgxVlic5Q16L3kbw/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">新的本地推送连接API由两个类<span style="color: black;">构成</span>:NEAppPushManager和NEAppPushProvider。NEAppPushManager在主App中<span style="color: black;">运用</span>,主App<span style="color: black;">运用</span>NEAppPushManager创建一个配置,配置中指定<span style="color: black;">详细</span>哪个WiFi网络下运行本地推送连接。你<span style="color: black;">能够</span><span style="color: black;">运用</span>NEAppPushManager加载/移除/<span style="color: black;">保留</span>配置。NEAppPushProvider则在App Extension<span style="color: black;">运用</span>。在App Extension中实现一个NEAppPushProvider的子类,子类中需要覆盖生命周期管理<span style="color: black;">办法</span>,这些<span style="color: black;">办法</span>在App Extension运行和停止时被调用。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">App Extension<span style="color: black;">重点</span>处理两类推送,一类是常规的推送<span style="color: black;">通告</span>,一类是VoIP呼叫<span style="color: black;">通告</span>。<span style="color: black;">倘若</span>是常规的推送<span style="color: black;">通告</span>,App Extension收到<span style="color: black;">信息</span>后,<span style="color: black;">能够</span><span style="color: black;">运用</span>UserNotification API构造一个本地推送<span style="color: black;">表示</span>推送信息。<span style="color: black;">倘若</span>是VoIP呼叫<span style="color: black;">通告</span>,App Extension<span style="color: black;">运用</span>NEAppPushProvider类将呼叫信息报告给系统。<span style="color: black;">倘若</span>此时主App不在运行,系统将唤醒主App,并将<span style="color: black;">信息</span>投递给它,最后主App再<span style="color: black;">运用</span>CallKit API<span style="color: black;">表示</span>呼叫界面。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/33P2FdAnju99Pg7S9548JB5fW3QeRbnzM8Nqfuf3wlhbURdReiagzVorOmwD8OzmwfX2NVZldnHpQ6DyF4KWllA/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">下面是在主App中<span style="color: black;">运用</span>NEAppPushManager的示例代码:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">以上</span>代码创建了一个NEAppPushManager实例,并配置实例的各个属性值。matchSSIDs<span style="color: black;">暗示</span>在指定的WiFi网络下才启用本地推送连接。providerBundleIdentifier<span style="color: black;">暗示</span>App Extension的包名,providerConfiguration是传给App Extension的<span style="color: black;">有些</span>配置,在App Extension内<span style="color: black;">能够</span><span style="color: black;">经过</span>NEAppPushProvider的providerConfiguration属性获取。isEnabled<span style="color: black;">暗示</span><span style="color: black;">运用</span>这个配置开启本地推送连接。最后调用saveToPreferences<span style="color: black;">办法</span>持久化配置。下面是App Extension实现NEAppPushProvider子类的示例代码:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">系统调用start(completionHandler:)<span style="color: black;">办法</span><span style="color: black;">起步</span>App Extension,在这个<span style="color: black;">办法</span>内App Extension与本地业务服务器<span style="color: black;">创立</span>连接。当App Extension停止运行,系统调用stop(with:)<span style="color: black;">办法</span>, 在这个<span style="color: black;">办法</span>内App Extension断开与业务服务器的连接。handleIncomingVoIPCall(callInfo:)<span style="color: black;">办法</span>在收到VoIP呼叫时被调用,在<span style="color: black;">办法</span>内App Extension调用reportIncomingCall(userInfo:)将该事件上报给系统。随后系统将会唤醒主App,并将呼叫信息传递给主App。主App处理系统传入的呼叫信息示例代码:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">以上代码在AppDelegate的didFinishLaunchingWithOptions<span style="color: black;">办法</span>内<span style="color: black;">运用</span>NEAppPushManager加载所有配置,并设置<span style="color: black;">每一个</span>NEAppPushManager示例的代理属性。系统会在主线程中将接收到呼叫信息<span style="color: black;">经过</span>didReceiveIncomingCallWithUserInfo<span style="color: black;">办法</span>投递给主App。主App必须<span style="color: black;">经过</span>CallKit API将呼入信息上报给CallKit展示呼叫界面。</p>
    <span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">价值场景</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">倘若</span>只<span style="color: black;">思虑</span>推送本身,<span style="color: black;">针对</span>手淘<span style="color: black;">或</span>大部分消费类应用<span style="color: black;">来讲</span>,笔者认为价值并不大,<span style="color: black;">由于</span>此类APP不可能在一个封闭的本地网络里去<span style="color: black;">安排</span>资源来<span style="color: black;">供给</span>服务能力。<span style="color: black;">这儿</span>一个可应用的点在于:设备一旦进入特定网络环境,触发App Extension, <span style="color: black;">从而</span>唤起主App,应用可在后台完成<span style="color: black;">必定</span>事务。<span style="color: black;">由于</span> iOS App <span style="color: black;">始终</span>缺乏后台服务能力,这种特定网络环境的触发唤醒,<span style="color: black;">极重</span>的<span style="color: black;">弥补</span>了这一能力。</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;"><strong style="color: blue;"><span style="color: black;">现代网络技术的应用</span></strong></h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">苹果在这次WWDC中,把<span style="color: black;">有些</span>较新的网络技术,对应用的体验<span style="color: black;">提高</span>,做了一个简单综述,<span style="color: black;">包含</span>IPv6、HTTP/2、TLS1.3, MTCP、以及HTTP/3。这些技术在手淘基本都有<span style="color: black;">触及</span>,有些是<span style="color: black;">已然</span>是大规模<span style="color: black;">安排</span>、有些是正在逐步推进中。对各个应用<span style="color: black;">来讲</span>,<span style="color: black;">倘若</span><span style="color: black;">已然</span>在应用这些技术了,则云端均尽可能标准化,便于进一步推广和复用。<span style="color: black;">这儿</span>简单的对苹果的综述做一个搬运:</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">&nbsp;IPv6</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">苹果<span style="color: black;">按照</span>最新统计,苹果<span style="color: black;">全世界</span>设备TCP连接占比中,IPv6占比26%,IPv4占比74%,其中74%的占比中有20%是<span style="color: black;">由于</span>服务端<span style="color: black;">无</span>开启IPv6支持。在建连时间方面,<span style="color: black;">因为</span>减少了NAT<span style="color: black;">运用</span>,<span style="color: black;">加强</span>了路由效率,IPv6的建连时间比IPv4快1.4倍。<span style="color: black;">研发</span>者只需<span style="color: black;">运用</span>URLSession和Network.framework API,IPv6网络适配将自动支持。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">以上是苹果的数据。阿里巴巴集团从18年<span style="color: black;">起始</span>大力推进IPv6的建设,<span style="color: black;">日前</span><span style="color: black;">咱们</span>在IPv6整体应用规模上在业界是属于头部大厂。但<span style="color: black;">按照</span><span style="color: black;">咱们</span>应用的<span style="color: black;">实质</span>效果数据,以及业界友商的应用数据,性能<span style="color: black;">提高</span>并不<span style="color: black;">显著</span>。以及工信部的IPv6建设<span style="color: black;">目的</span>来看,性能<span style="color: black;">提高</span><span style="color: black;">亦</span>不是IPv6建设的<span style="color: black;">目的</span>,只要达到IPv4同等水平<span style="color: black;">就可</span>。IPv6 的<span style="color: black;">道理</span>就在<span style="color: black;">处理</span>IPv4<span style="color: black;">位置</span>空间枯竭的问题,<span style="color: black;">更加多</span>的在规模、安全,而不是性能<span style="color: black;">提高</span>。就企业而言,例如<span style="color: black;">能够</span>降低IPv4<span style="color: black;">位置</span>的购买<span style="color: black;">花费</span>;就国家而言,IPv6 突破了IPv4中国境内无DNS根结点的<span style="color: black;">危害</span>。IPv6<span style="color: black;">日前</span><span style="color: black;">周期</span>在国内尚<span style="color: black;">处在</span>发展中,<span style="color: black;">基本</span>运营商覆盖、家用网络接入设备支持、应用服务的支持,正在快速发展中。</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">HTTP/2</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">HTTP/2的多路复用特性使得对同一服务器的多个请求复用到单个连接上,不必等待前一个请求响应结束<span style="color: black;">才可</span>发送下一个请求,不仅节省了时间<span style="color: black;">亦</span><span style="color: black;">提高</span>了性能。头部压缩特性<span style="color: black;">提高</span>了带宽利用率,<span style="color: black;">经过</span>简化<span style="color: black;">信息</span>内容,从而降低<span style="color: black;">信息</span>的<span style="color: black;">体积</span>。<span style="color: black;">按照</span>最新统计,在Safari中HTTP2 Web流量占比79%,HTTP/2比HTTP/1.1快1.8倍。<span style="color: black;">倘若</span>服务端支持HTTP/2,URLSession将默认<span style="color: black;">运用</span>HTTP/2。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在手淘业务中,全面应用HTTP2<span style="color: black;">已然</span>有三四年之久,其<span style="color: black;">运用</span>规模比苹果统计的结果要高的多,取得了巨大的体验<span style="color: black;">提高</span>收获。手淘的核心流量分为两类:API请求MTOP于<span style="color: black;">照片</span>CDN请求,这两类的HTTP2的流量占比约超过 98%,基本实现核心流量<span style="color: black;">所有</span>长连化。但当前手淘的HTTP2技术在设备支持之前即大规模应用,协议栈完全自研,为进一步<span style="color: black;">提高</span>建联速度,又做了<span style="color: black;">有些</span>预置证书的优化。下一步将逐步使<span style="color: black;">基本</span>网络依赖标准化平台能力,降低对私有协议栈的依赖,可降低包<span style="color: black;">体积</span>以及<span style="color: black;">提高</span><span style="color: black;">制品</span>复用体验。</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">TLS1.3</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">TLS1.3<span style="color: black;">经过</span>减少一次握手减少了建连时间,<span style="color: black;">经过</span>形式化验证(Formal Verification)与减少被错误配置的可能性,<span style="color: black;">加强</span>了通信安全。从iOS 13.4<span style="color: black;">起始</span>,TLS1.3默认在URLSession和Network.framework开启。<span style="color: black;">按照</span>最新统计,在最新的iOS系统上,大约49%的连接<span style="color: black;">运用</span>TLS1.3。<span style="color: black;">运用</span>TLS1.3比<span style="color: black;">运用</span>TLS1.2建连时间快1.3倍。<span style="color: black;">倘若</span>服务端支持TLS1.3,URLSession将默认<span style="color: black;">运用</span>TLS1.3。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">日前</span>手淘的HTTP/2 的TLS version仍然还是基于TLS1.2,<span style="color: black;">不外</span>为<span style="color: black;">认识</span>决低版本TLS的性能之殇,手淘网络<span style="color: black;">经过</span>预置证书与自定义 SSL 握手流程,创新自研了slight-ssl协议,实现了 0rtt 的效果。TLS 1.3 标准在系统层面的全面支持,对应用<span style="color: black;">来讲</span>是一个<span style="color: black;">知道</span>的技术趋势信号,<span style="color: black;">咱们</span>的网络协议需尽快标准化,对网络管道两端<span style="color: black;">来讲</span>,客户端应用层网络接口需全面升级到NSURLSession或Network.framework, 实现对系统标准能力的应用;云端<span style="color: black;">亦</span>许全面支持TLS1.3,可不依赖端侧SDK<span style="color: black;">就可</span><span style="color: black;">供给</span>更新安全、<span style="color: black;">有效</span>、标准的网连接。</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">MultiPath TCP</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">MultiPath TCP <span style="color: black;">准许</span>在一条TCP链路中<span style="color: black;">创立</span>多个子通道。当设备切换网络时,单个TCP连接依然<span style="color: black;">能够</span>继续<span style="color: black;">运用</span>。苹果的Apple Music与Siri服务都<span style="color: black;">运用</span>了MultiPath TCP。Apple Music在<span style="color: black;">运用</span>MultiPath TCP之后,音乐播放卡顿次数减少了13%,卡顿<span style="color: black;">连续</span>时间减少了22%。开启MultiPath TCP需要客户端和服务端都支持<span style="color: black;">才可</span>生效,服务端支持MultiPath TCP可参考:</span><span style="color: black;">http://multipath-tcp.org/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">其实手淘在这方面<span style="color: black;">亦</span>有类似的优化尝试:多网卡:<span style="color: black;">同期</span><span style="color: black;">经过</span>Wi-Fi与蜂窝网连接<span style="color: black;">目的</span>服务器,<span style="color: black;">提高</span>数据传输速度。其技术原理与MTCP不<span style="color: black;">同样</span>,但<span style="color: black;">亦</span>是想在上层起到类似<span style="color: black;">功效</span>:<span style="color: black;">经过</span>多路连接,<span style="color: black;">提高</span>数据交换带宽。业界<span style="color: black;">亦</span>有类似的<span style="color: black;">制品</span>,例如华为的 LinkTurbo。</span></p><span style="color: black;"><strong style="color: blue;"><span style="color: black;">▐ </span></strong></span><span style="color: black;"><strong style="color: blue;"><span style="color: black;">HTTP/3</span></strong></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">HTTP/3是下一代HTTP协议,它是构建在新的QUIC传输协议之上,QUIC协议内建了对TLS1.3的支持,并<span style="color: black;">供给</span>了与HTTP/2<span style="color: black;">同样</span>的多路复用功能,并进一步减少了队头阻塞的<span style="color: black;">出现</span>,让单个请求或相应的丢失不影响到其他请求。<span style="color: black;">运用</span>QUIC的HTTP/3还<span style="color: black;">拥有</span>较高的保真度信息,以<span style="color: black;">供给</span>改进的拥塞<span style="color: black;">掌控</span>和丢包恢复。<span style="color: black;">同期</span><span style="color: black;">亦</span><span style="color: black;">包含</span>内建的移动性支持,<span style="color: black;">这般</span>网络切换不会<span style="color: black;">引起</span>正在进行的操作失败,<span style="color: black;">能够</span>无缝在<span style="color: black;">区别</span>网络之间切换。<span style="color: black;">不外</span>HTTP/3<span style="color: black;">日前</span>还处于草案<span style="color: black;">周期</span>,iOS 14和MacOS Big Sur<span style="color: black;">包含</span>了一个对<span style="color: black;">运用</span>URLSession的HTTP/3的实验预览支持,这个功能<span style="color: black;">能够</span>在<span style="color: black;">研发</span>者设置中开启。<span style="color: black;">同期</span>Safari的HTTP/3支持<span style="color: black;">亦</span>可在<span style="color: black;">研发</span>者设置中开启。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在手淘中,<span style="color: black;">咱们</span>的QUIC应用应该会早于苹果系统先行支持,<span style="color: black;">日前</span><span style="color: black;">已然</span>在灰度中。</span></p><strong style="color: blue;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">手淘客户端团队</span></strong></span></strong><span style="color: black;">手淘客户端团队正在进行社招招聘,岗位有iOS Android客户端<span style="color: black;">研发</span>工程师、欢</span><span style="color: black;">迎 转岗<span style="color: black;">举荐</span>。</span><span style="color: black;">简历投递:</span><span style="color: black;"><strong style="color: blue;">junzhan.yzw@taobao.com</strong></span><span style="color: black;">✿&nbsp;</span>&nbsp;<strong style="color: blue;"><span style="color: black;">拓展阅读</span></strong><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"><a style="color: black;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></a><a style="color: black;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></a><strong style="color: blue;"><span style="color: black;">作者|</span></strong><span style="color: black;">徐杰(无宸)</span><strong style="color: blue;"><span style="color: black;">编辑|</span></strong><span style="color: black;">橙子君</span><strong style="color: blue;"><span style="color: black;">出品|</span></strong><span style="color: black;">阿里巴巴新零售淘系技术</span><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;">




qzmjef 发表于 2024-10-8 15:08:51

你的见解真是独到,让我受益匪浅。

wrjc1hod 发表于 7 天前

论坛的成功是建立在我们诚恳、务实、高效、创新和团结合作基础上,我们要把这种精神传递下去。
页: [1]
查看完整版本: WWDC:无线网络优化实践,带来哪些启发?