当前位置:网站首页>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
边栏推荐
- MySQL information schema learning (I) -- general table
- Swiftui game source code Encyclopedia of Snake game based on geometryreader and preference
- LeetCode_双指针_中等_61. 旋转链表
- CF960G - Bandit Blues(第一类斯特林数+OGF)
- Problems encountered in using RT thread component fish
- [translation] a GPU approach to particle physics
- 业务与应用同步发展:应用现代化的策略建议
- MRO industrial products enterprise procurement system: how to refine procurement collaborative management? Industrial products enterprises that want to upgrade must see!
- Leetcode 30. 串联所有单词的子串
- Black Horse - - Redis Chapter
猜你喜欢

潇洒郎: AttributeError: partially initialized module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipe

五金机电行业智能供应链管理系统解决方案:数智化供应链为传统产业“造新血”

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

Intelligent supply chain management system solution for hardware and electromechanical industry: digital intelligent supply chain "creates new blood" for traditional industries

Interface test tool - postman

LeetCode-1279. Traffic light intersection
![[translation] micro survey of cloud native observation ability. Prometheus leads the trend, but there are still obstacles to understanding the health of the system](/img/63/3addcecb69dcb769c4736653952f66.png)
[translation] micro survey of cloud native observation ability. Prometheus leads the trend, but there are still obstacles to understanding the health of the system

反射及在运用过程中出现的IllegalAccessException异常
Interview assault 63: how to remove duplication in MySQL?

DaGAN论文解读
随机推荐
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
php+redis实现超时取消订单功能
Elastic search indexes are often deleted [closed] - elastic search indexes gets deleted frequently [closed]
今日直播 | “人玑协同 未来已来”2022弘玑生态伙伴大会蓄势待发
如何自定义动漫头像?这6个免费精品在线卡通头像生成器,看一眼就怦然心动!
1805. 字符串中不同整数的数目
It's super detailed in history. It's too late for you to read this information if you want to find a job
Druid 数据库连接池 详解
三面蚂蚁金服成功拿到offer,Android开发社招面试经验
接雨水问题解析
Mind map + source code + Notes + project, ByteDance + JD +360+ Netease interview question sorting
LeetCode_双指针_中等_61. 旋转链表
[translation] a GPU approach to particle physics
[translation] Digital insider. Selection process of kubecon + cloudnativecon in Europe in 2022
通俗的讲解,带你入门协程
Interview assault 63: how to remove duplication in MySQL?
Mysql Information Schema 學習(一)--通用錶
USB host driver - UVC swap
Countdown 2 days | live broadcast preview of Tencent cloud message queue data import platform
Leetcode 30. 串联所有单词的子串