当前位置:网站首页>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
边栏推荐
- Vmware虚拟机无法打开内核设备“\\.\Global\vmx86“的解决方法
- Swiftui game source code Encyclopedia of Snake game based on geometryreader and preference
- Cereals Mall - Distributed Advanced p129~p339 (end)
- Tensorflow and torch code verify whether CUDA is successfully installed
- 主从搭建报错:The slave I/O thread stops because master and slave have equal MySQL serv
- 【翻译】数字内幕。KubeCon + CloudNativeCon在2022年欧洲的选择过程
- Is not a drawable (color or path): the vector graph downloaded externally cannot be called when it is put into mipmap, and the calling error program crashes
- Test technology stack arrangement -- self cultivation of test development engineers
- MRO industrial products enterprise procurement system: how to refine procurement collaborative management? Industrial products enterprises that want to upgrade must see!
- Using clip path to draw irregular graphics
猜你喜欢

MySQL information schema learning (II) -- InnoDB table

zabbix 代理服务器 与 zabbix-snmp 监控

系统性详解Redis操作Hash类型数据(带源码分析及测试结果)

ACTF 2022圆满落幕,0ops战队二连冠!!

Mysql Information Schema 学习(二)--Innodb表

黑馬--Redis篇
![[translation] linkerd's adoption rate in Europe and North America exceeded istio, with an increase of 118% in 2021.](/img/09/106adc222c06cbd2f4f66cf475cce2.jpg)
[translation] linkerd's adoption rate in Europe and North America exceeded istio, with an increase of 118% in 2021.

【计算情与思】扫地僧、打字员、信息恐慌与奥本海默

Sanmian ant financial successfully got the offer, and has experience in Android development agency recruitment and interview

Black Horse - - Redis Chapter
随机推荐
How to do smoke test
学习探索-使用伪元素清除浮动元素造成的高度坍塌
About image reading and processing, etc
A popular explanation will help you get started
Mysql Information Schema 学习(二)--Innodb表
ModuleNotFoundError: No module named ‘PIL‘解决方法
Low CPU load and high loadavg processing method
MRO工业品企业采购系统:如何精细化采购协同管理?想要升级的工业品企业必看!
CCNP Part 11 BGP (III) (essence)
1805. 字符串中不同整数的数目
Detailed idea and code implementation of infix expression to suffix expression
JDBC详解
冒烟测试怎么做
在解决了 2961 个用户反馈后,我做出了这样的改变...
Benefit a lot, Android interview questions
第五期个人能力认证考核通过名单公布
Yyds dry goods inventory leetcode question set 751 - 760
In 50W, what have I done right?
如何自定义动漫头像?这6个免费精品在线卡通头像生成器,看一眼就怦然心动!
系统性详解Redis操作Hash类型数据(带源码分析及测试结果)