当前位置:网站首页>Phoenix Architecture 2 - accessing remote services
Phoenix Architecture 2 - accessing remote services
2022-07-06 19:30:00 【Groundhog breeder】
Access remote services
Remote service invocation
Interprocess communication (Inter-Process Communication,IPC) The way to
- The Conduit (Pipe) Or named pipeline (Named Pipe): Pass a small number of character streams or byte streams , Common pipes are only used for related processes ( Another process started by one process ) Communication between , Named pipeline gets rid of the limitation that ordinary pipeline has no name , In addition to all the functions of the pipeline , It also allows communication between unrelated processes
- The signal (Signal): Notifies the target process that an event has occurred
- Semaphore (Semaphore): Synchronous collaboration means between two processes
- Message queue (Message Queue): Can transmit a large amount of information , But the real-time performance is relatively limited
- Shared memory (Shared Memory): Allow multiple processes to access the same common memory space
- Socket interface (Socket): It can be used for process communication between different machines
RPC There are three basic problems in this paper
- How to represent data : The data involved in the interaction between the two parties will be transformed into a neutral data stream format agreed in advance for transmission , Convert the data stream back to the corresponding data type in different languages for use ( Such as serialization and deserialization )
- How to pass data : Through the network , In two services Endpoint Operate with each other 、 Exchange data ( Application layer protocol ).
- How to determine the method : How different languages express the same method
Different RPC
None of them RPC It can perfectly satisfy the above three points , So there are different RPC
- Towards object-oriented development :RMI, This line has an alias called distributed objects
- Towards performance ( Serialization efficiency and information density ):gRPC ( be based on HTTP/2 Of , Support multiplexing and Header Compress ) and Thrift( Transport layer based TCP Protocol to implement , Eliminates the overhead of additional application layer protocols )
- Towards simplification , Representative for JSON-RPC( The simplicity and portability of the agreement , The interface and format are more general )
REST Design style
RPC Procedure call oriented ,REST Resource oriented invocation
Fielding Think , An ideal 、 Completely satisfied REST Style system should meet the following six principles :
- The server is separated from the client (Client-Server): Separate the logic of the user interface from the logic of the data store , It helps to improve the cross platform portability of the user interface
- No state (Stateless): In the request sent by the client , All necessary contextual information shall be included , The session information is also saved and maintained by the client , The server executes business processing logic according to the state transmitted by the client
- Caching (Cacheability): A well functioning caching mechanism can reduce the number of clients 、 Interaction between servers
- Layered system (Layered System): The client does not need to know whether it is directly connected to the final server
- Unified interface (Uniform Interface):
- On demand code (Code-On-Demand): The client does not need to know in advance how to handle all the information from the server 、 How to run tolerance
Advantages and disadvantages
advantage
- Reduced learning costs of service interfaces : Standard operations on resources are mapped to standard HTTP The way up
- Natural resources have set and hierarchy : Resource centric abstract interfaces , Because the resource is Noun , Naturally, collections and hierarchies can be generated .
GET /users/icyfenix/cart/2
- REST Bound to HTTP agreement .
Deficiencies and disputes
- The idea of resource oriented programming is only suitable for CRUD, Process oriented 、 Only object-oriented programming can deal with really complex business logic : The idea of resource-oriented programming is different from the other two mainstream programming ideas when they are only abstract problems , Only choice questions , There's no difference between high and low
- REST And HTTP Fully bound , It is not suitable for applications requiring high-performance transmission : Resource oriented programming is protocol independent , however REST It does depend on HTTP Standard approach to protocol 、 Status code 、 The first aspect of the agreement , For transmission requiring direct control , Such as binary details 、 Coding form 、 Message format 、 In the scene of connection mode and other details ,REST Not really , These scenarios often exist between the internal nodes of the service cluster
- REST Not conducive to transaction support : If you give up rigid transactions , Use REST There must be no hindrance
- REST No transmission reliability support
- REST Lack of resources “ part ” and “ Batch ” Handling capacity of
边栏推荐
- Leetcode topic [array] - 119 Yang Hui triangle II
- Druid 数据库连接池 详解
- Low CPU load and high loadavg processing method
- Computer network: sorting out common network interview questions (I)
- Swagger2 reports an error illegal DefaultValue null for parameter type integer
- 时钟轮在 RPC 中的应用
- Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting
- MRO industrial products enterprise procurement system: how to refine procurement collaborative management? Industrial products enterprises that want to upgrade must see!
- Synchronous development of business and application: strategic suggestions for application modernization
- GCC【7】- 编译检查的是函数的声明,链接检查的是函数的定义bug
猜你喜欢
CCNP Part 11 BGP (III) (essence)
Application of clock wheel in RPC
Take a look at how cabloyjs workflow engine implements activiti boundary events
Documents to be used in IC design process
Detailed idea and code implementation of infix expression to suffix expression
Countdown 2 days | live broadcast preview of Tencent cloud message queue data import platform
MRO工业品企业采购系统:如何精细化采购协同管理?想要升级的工业品企业必看!
Synchronous development of business and application: strategic suggestions for application modernization
IC设计流程中需要使用到的文件
倒计时2天|腾讯云消息队列数据接入平台(Data Import Platform)直播预告
随机推荐
业务与应用同步发展:应用现代化的策略建议
MySQL information Schema Learning (i) - - General table
MySQL information schema learning (II) -- InnoDB table
Graffiti intelligence is listed on the dual main board in Hong Kong: market value of 11.2 billion Hong Kong, with an annual revenue of 300 million US dollars
Help improve the professional quality of safety talents | the first stage of personal ability certification and assessment has been successfully completed!
A method of removing text blur based on pixel repair
Elastic search indexes are often deleted [closed] - elastic search indexes gets deleted frequently [closed]
[translation] a GPU approach to particle physics
凤凰架构2——访问远程服务
Swiftui game source code Encyclopedia of Snake game based on geometryreader and preference
Mysql Information Schema 学习(一)--通用表
[玩转Linux] [Docker] MySQL安装和配置
C language daily practice - day 22: Zero foundation learning dynamic planning
Druid 数据库连接池 详解
Unbalance balance (dynamic programming, DP)
Simple understanding of MySQL database
LeetCode-1279. Traffic light intersection
从sparse.csc.csr_matrix生成邻接矩阵
Looting iii[post sequence traversal and backtracking + dynamic planning]
An error occurs when installing MySQL: could not create or access the registry key needed for the