知识卡片

普通读书笔记卡 · 3217.a

RPC状态与耦合取舍

理解等级:高级

REST 约束交互无状态,RPC 是否维护状态则由具体实现决定。累积状态可能让某些调用更方便或更快,但也会增加路由和故障恢复难度;按远端方法直接暴露内部能力,还可能让消费者与服务实现更紧密地联动。高性能内部调用可以接受有意识的耦合,前提是把代价写进设计。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      A key difference between REST and RPC is state. REST is by definition stateless—with RPC state depends on the implementation. RPC-based integrations in certain situations can also build up state as part of the exchange. This buildup of state has the convenience of high performance at the potential cost of reliability and routing complexities. With RPC the model tends to convey the exact functionality at a method level that is required from a secondary service.

    参考来源

    - 位置:《Mastering API Architecture》第1章《Design, Build, and Specify APIs》之《Introduction to Remote Procedure Call (RPC) APIs》(源文件:_epub-src/OEBPS/ch01.xhtml) - 结论依据:原文直接对比 REST 的无状态与 RPC 由实现决定的状态,并指出状态便利伴随可靠性和路由复杂度、方法级接口可增加耦合。 - 原始内容:A key difference between REST and RPC is state. REST is by definition stateless—with RPC state depends on the implementation. RPC-based integrations in certain situations can also build up state as part of the exchange. This buildup of state has the convenience of high performance at the potential cost of reliability and routing complexities. With RPC the model tends to convey the exact functionality at a method level that is required from a secondary service.