<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>TRPC - 标签 - 研发日志 · R&amp;D Log</title><link>https://rd163.visword.com/tags/trpc/</link><description>TRPC - 标签 - 研发日志 · 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>Wed, 09 Jul 2025 00:00:00 +0800</lastBuildDate><atom:link href="https://rd163.visword.com/tags/trpc/" rel="self" type="application/rss+xml"/><item><title>trpc/brpc/grpc 协议设计对比</title><link>https://rd163.visword.com/posts/proto_disign_for_trpc_grpc_brpc/</link><pubDate>Wed, 09 Jul 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/proto_disign_for_trpc_grpc_brpc/</guid><description><![CDATA[<p>在微服务与高性能后端场景中，RPC(Remote Procedure Call，远程过程调用)框架的协议设计直接决定了吞吐、延迟、可观测性和生态兼容性。本文梳理三套具有代表性的 RPC 协议：腾讯开源的 <strong>tRPC</strong>、Apache <strong>bRPC</strong>(baidu_std)以及 Google 主导的 <strong>gRPC</strong>,从协议帧格式、通信模式和传输层三个维度做对比。</p>]]></description></item><item><title>trpc微服务寻址方案设计</title><link>https://rd163.visword.com/posts/trpc-service-addressing-scheme-design/</link><pubDate>Sun, 01 Jun 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/trpc-service-addressing-scheme-design/</guid><description><![CDATA[<h2 id="服务命名" class="headerLink">
    <a href="#%e6%9c%8d%e5%8a%a1%e5%91%bd%e5%90%8d" class="header-mark"></a>服务命名</h2><p>tRPC 在服务命名上定义了以下 3 个维度信息：</p>
<ul>
<li><strong>app 名（应用名）</strong>：表示某个业务系统的名称，用于标识某个业务下不同服务模块的一个集合。</li>
<li><strong>server 名（模块名）</strong>：表示具体服务模块的名称，一般也称为模块的进程名称。</li>
<li><strong>service 名</strong>：表示具体服务提供者的名称，一般使用 proto 文件定义的 Service 名称。</li>
</ul>
<p>其中 <code>app.server</code> 的组合在全局上要具备唯一性。</p>]]></description></item><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><item><title>C++协程介绍</title><link>https://rd163.visword.com/posts/fiber-intro-for-cpp/</link><pubDate>Mon, 31 Mar 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/fiber-intro-for-cpp/</guid><description><![CDATA[<h2 id="协程coroutine与纤程fiber区别" class="headerLink">
    <a href="#%e5%8d%8f%e7%a8%8bcoroutine%e4%b8%8e%e7%ba%a4%e7%a8%8bfiber%e5%8c%ba%e5%88%ab" class="header-mark"></a>协程（coroutine）与纤程（fiber）区别</h2><h3 id="协程coroutine" class="headerLink">
    <a href="#%e5%8d%8f%e7%a8%8bcoroutine" class="header-mark"></a>协程（Coroutine）</h3><p>N:1 协程。</p>
<p>协程是语言级别的特性（C++20 原生支持），由编译器生成状态机逻辑，通过 <code>co_await</code>、<code>co_yield</code> 等关键字实现隐式挂起和恢复，无需直接操作底层上下文。</p>]]></description></item></channel></rss>