当前位置:网站首页>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
边栏推荐
- 学习探索-函数防抖
- GCC [7] - compilation checks the declaration of functions, and link checks the definition bugs of functions
- Modulenotfounderror: no module named 'PIL' solution
- 【计算情与思】扫地僧、打字员、信息恐慌与奥本海默
- 学习探索-无缝轮播图
- Countdown 2 days | live broadcast preview of Tencent cloud message queue data import platform
- Spark foundation -scala
- 冒烟测试怎么做
- A method of removing text blur based on pixel repair
- Mind map + source code + Notes + project, ByteDance + JD +360+ Netease interview question sorting
猜你喜欢
ZABBIX proxy server and ZABBIX SNMP monitoring
LeetCode-1279. Traffic light intersection
学习探索-无缝轮播图
【基础架构】Flink/Flink-CDC的部署和配置(MySQL / ES)
MySQL information schema learning (I) -- general table
LeetCode_双指针_中等_61. 旋转链表
Mathematical knowledge -- code implementation of Gaussian elimination (elementary line transformation to solve equations)
It's super detailed in history. It's too late for you to read this information if you want to find a job
助力安全人才专业素养提升 | 个人能力认证考核第一阶段圆满结束!
Low CPU load and high loadavg processing method
随机推荐
Synchronous development of business and application: strategic suggestions for application modernization
ACTF 2022圆满落幕,0ops战队二连冠!!
121. 买卖股票的最佳时机
MySQL information Schema Learning (i) - - General table
Simple application of VBA script in Excel
How can my Haskell program or library find its version number- How can my Haskell program or library find its version number?
零基础入门PolarDB-X:搭建高可用系统并联动数据大屏
C language daily practice - day 22: Zero foundation learning dynamic planning
深入分析,Android面试真题解析火爆全网
终于可以一行代码也不用改了!ShardingSphere 原生驱动问世
通俗的讲解,带你入门协程
How to access localhost:8000 by mobile phone
About image reading and processing, etc
spark基础-scala
Simple understanding of MySQL database
Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting
Carte de réflexion + code source + notes + projet, saut d'octets + jd + 360 + tri des questions d'entrevue Netease
[pytorch] yolov5 train your own data set
Dom 操作