当前位置:网站首页>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
边栏推荐
- 全套教学资料,阿里快手拼多多等7家大厂Android面试真题
- Detailed idea and code implementation of infix expression to suffix expression
- GCC [7] - compilation checks the declaration of functions, and link checks the definition bugs of functions
- Mysql Information Schema 學習(一)--通用錶
- First day of rhcsa study
- Vmware虚拟机无法打开内核设备“\\.\Global\vmx86“的解决方法
- Interview assault 63: how to remove duplication in MySQL?
- 利用 clip-path 绘制不规则的图形
- CF960G - Bandit Blues(第一类斯特林数+OGF)
- ACTF 2022圆满落幕,0ops战队二连冠!!
猜你喜欢

【翻译】Linkerd在欧洲和北美的采用率超过了Istio,2021年增长118%。

Live broadcast today | the 2022 Hongji ecological partnership conference of "Renji collaboration has come" is ready to go

思维导图+源代码+笔记+项目,字节跳动+京东+360+网易面试题整理

RT-Thread 组件 FinSH 使用时遇到的问题

Documents to be used in IC design process

Computer network: sorting out common network interview questions (I)
Application of clock wheel in RPC

ZABBIX proxy server and ZABBIX SNMP monitoring

Simple understanding of MySQL database

The list of people who passed the fifth phase of personal ability certification assessment was published
随机推荐
MySQL information schema learning (I) -- general table
Low CPU load and high loadavg processing method
Modulenotfounderror: no module named 'PIL' solution
Use of map (the data of the list is assigned to the form, and the JSON comma separated display assignment)
接雨水问题解析
LeetCode_ Double pointer_ Medium_ 61. rotating linked list
Excel 中VBA脚本的简单应用
JDBC details
How can my Haskell program or library find its version number- How can my Haskell program or library find its version number?
The slave i/o thread stops because master and slave have equal MySQL serv
PMP每日一练 | 考试不迷路-7.6
short i =1; I=i+1 and short i=1; Difference of i+=1
第五期个人能力认证考核通过名单公布
How to type multiple spaces when editing CSDN articles
Take a look at how cabloyjs workflow engine implements activiti boundary events
Druid database connection pool details
MRO industrial products enterprise procurement system: how to refine procurement collaborative management? Industrial products enterprises that want to upgrade must see!
史上超级详细,想找工作的你还不看这份资料就晚了
MySQL information Schema Learning (i) - - General table
Solution of intelligent management platform for suppliers in hardware and electromechanical industry: optimize supply chain management and drive enterprise performance growth