<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Streaming - 标签 - 研发日志 · R&amp;D Log</title><link>https://rd163.visword.com/tags/streaming/</link><description>Streaming - 标签 - 研发日志 · R&amp;D Log</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>whutluohui@gmail.com (小智晖)</managingEditor><webMaster>whutluohui@gmail.com (小智晖)</webMaster><copyright>本作品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可。</copyright><lastBuildDate>Tue, 01 Apr 2025 00:00:00 +0800</lastBuildDate><atom:link href="https://rd163.visword.com/tags/streaming/" rel="self" type="application/rss+xml"/><item><title>trpc-cpp流式服务</title><link>https://rd163.visword.com/posts/trpc-cpp-stream-service/</link><pubDate>Tue, 01 Apr 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/trpc-cpp-stream-service/</guid><description><![CDATA[<h2 id="流式应用场景" class="headerLink">
    <a href="#%e6%b5%81%e5%bc%8f%e5%ba%94%e7%94%a8%e5%9c%ba%e6%99%af" class="header-mark"></a>流式应用场景</h2><ul>
<li>大规模数据包。 比如，有一个大文件需要传输。 使用流式 RPC 时，客户端分片读出文件内容后直接写入到流中，服务端可以按客户端写入顺序读取到文件分片内容，然后执行业务逻辑。 如果使用单次 RPC，需要多次调用RPC方法，会遇到分包、组包、乱序、业务逻辑上下文切换等问题。</li>
<li>实时场景。 比如，股票行情走势，资讯 Feeds 流。 服务端接收到消息后，需要往多个客户端进行实时消息推送，流式 RPC 可以在一次 RPC 调用过程中，推送完整的消息列表。</li>
<li>Istio、Envoy、Nacos 等项目，内部都是用 gRPC 作为通信协议来实现控制平面</li>
</ul>
<h2 id="三种流式-rpc-方法" class="headerLink">
    <a href="#%e4%b8%89%e7%a7%8d%e6%b5%81%e5%bc%8f-rpc-%e6%96%b9%e6%b3%95" class="header-mark"></a>三种流式 RPC 方法</h2><p>tRPC 协议的流式 RPC 分为三种类型：</p>]]></description></item></channel></rss>