当前位置:网站首页>Teach you to learn dapr - 2 Must know concept
Teach you to learn dapr - 2 Must know concept
2022-06-26 16:45:00 【Masa technical team】
Sidecar Side car
Dapr API Provide Http and gRPC Two ways of communication .
The operation mode can be container or process (Windows Development recommends using Self Hosted, I'll explain later ).
This benefit is independent of the operating environment , And independent operation does not require the application to include Dapr Run time code . Just go through SDK Just integrate , This makes Dapr Logical separation from application .

Building blocks Building blocks
Official explanation : Can pass the standard HTTP or gRPC api Modular best practices for access
To put it more generally , Namely API
The currently supported building blocks are as follows , but 1.5 A new one will come out soon Configuration API( From this new API It also confirms the essence of building blocks ), By Ali - Ao Xiaojian took the lead to organize
Github Issue: https://github.com/dapr/dapr/issues/2988
The proposal is long , It's tortuous . If you look carefully, you will find some ideological collisions under the environment of Chinese and foreign development . Microsoft is relatively conservative , Ali is relatively radical but also more pragmatic . The final version was finalized after months of intense discussion .
During this period, I also had the honor to communicate with
Ali - Ao XiaojianandAli - Ceremony(Layotto My research and development classmates ,Layotto compatible Dapr agreement , Ants are doing ) Had a voice conference and talked about Configuration API Some design problems .
- The service call
- State management
- Publish subscribe
- binding
- Actor( This is not recommended to be translated back into Chinese )
- Observability
- Security

Components Components
Official explanation : Modular functions used for building blocks and Applications
Dapr Use modular design , Provide functions as components . Each component has an interface definition . All components are pluggable , So you can replace the component with another component with the same interface .
Combined with the building blocks , Components have interface definitions . Building blocks connect the functions of components through interfaces
Based on the Dapr Understanding of design , our
MASA FrameworkIt also defines BuildingBlocks and Contrib, And dapr It will be a little differentHere's why :
- from BuildingBlocks Define the standard 、 A string of business processes
- Give Way Contrib Become our best practice , And allow development to redefine BuildingBlocks The concrete realization of , On the premise of ensuring the integrity of functions, there are reference codes to provide functions more in line with business scenarios
- Focus on core code stability , Provide unit test coverage guarantee , Share the wisdom of the public
Components and building blocks do not correspond one-to-one , Components can be reused by different building blocks , such as Actor State management within a building block is also a state storage component
- State storage
- Service discovery
- middleware
- Publish and subscribe agents
- binding
- Key storage
Configuration To configure
Official explanation : change Dapr Sidecar Or the whole situation Dapr The behavior of system services
The configuration definition and deployment form are YAML file
In the official document Component sepcs You can see how many implementations each component provides , Support of each implementation feature
In addition, there are all kinds of configuration file formats for different components
The official document explains the component configuration in great detail , Here's an example ,Redis Configuration file format for state management
The part you need to change has been used <*> and # * Marked
Reference from :https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-redis/
apiVersion: dapr.io/v1alpha1kind: Componentmetadata: name: <NAME> namespace: <NAMESPACE>spec: type: state.redis version: v1 metadata: - name: redisHost value: <HOST> - name: redisPassword value: <PASSWORD> - name: enableTLS value: <bool> # Optional. Allowed: true, false. - name: failover value: <bool> # Optional. Allowed: true, false. - name: sentinelMasterName value: <string> # Optional - name: maxRetries value: # Optional - name: maxRetryBackoff value: # Optional - name: ttlInSeconds value: <int> # OptionalObservability Observability
Official explanation : By tracking 、 indicators 、 Log and health monitoring applications
When building an application , Understanding how the system works is an important part of operation and maintenance —— This includes the ability to observe the internal calls of the application , Evaluate its performance and be immediately aware of problems when they occur
This is a challenge for any system , This is especially true for distributed systems composed of multiple microservices
Distributed tracking
Configure sending tracking data , Easily integrate multiple monitoring back ends

OpenTelemetry collector
To configure OpenTelemetry The collector , Use support OpenTelemetry Monitoring backend for

Dapr Sidecar And observability of system services
Configure collection Dapr Sidecar And related service indicators and logs

Security Security
Dapr One of the security mechanisms used to encrypt data in transmission is Mutual authentication (mutual authentication)TLS Or abbreviated as mTLS
- Two way authentication
- Communicate via encrypted channels
Sidecar Communicating with Applications
Dapr Sidecar adopt localhost Communicating with Applications , And provide Token API Level Authentication
Sidecar Communication between
Dapr Default on mTLS( Can be closed manually , There is a certain loss of performance , In most cases, it can be ignored ).Dapr utilize Sentry The system service acts as a certification authority , Including certificate rotation .
The default validity period of the certificate is 24 Hours , The clock deviation is 15 minute .
Self Hosted mTLS

K8s mTLS

Sidecar Communication with system services
Dapr Sidecar and Dapr Between system services is mandatory mTLS Of , Include Sentry( Certification authority )、Placement(Actor Resettlement services ) and K8s Operator
K8s Of system services in mTLS
- Dapr Sidecar And Dapr system service (Actor Placement, Sidecar Injector, Sentry, Operator) Between is through mTLS
- Kubelet And Dapr Sidecar Between is also through mTLS
- Dapr Sidecar perhaps Dapr System services and Components Between is also through mTLS
- Dapr Sidecar There is no connection with the application

Actually Dapr A lot of work has been done on security , I won't list them one by one here
We are acting , New framework 、 New ecology
Our goal is The freedom of the 、 Easy-to-use 、 Highly malleable 、 functional 、 Robust .
So we learn from Building blocks Design concept of , Working on a new framework MASA Framework, What are its characteristics ?
- Native support Dapr, And allow Dapr Replace with traditional means of communication
- Unlimited architecture , Single application 、SOA、 Micro services support
- Support .Net Native framework , Reduce the burden of learning , In addition to the concepts that must be introduced in a specific field , Insist on not making new wheels
- Rich ecological support , In addition to the framework, there are component libraries 、 Authority Center 、 Configuration center 、 Troubleshooting center 、 A series of products such as Alarm Center
- Unit test coverage of the core code base 90%+
- Open source 、 free 、 Community driven
- What is the ? We are waiting for you , Come together and discuss
After several months of production project practice , Completed POC, At present, the previous accumulation is being refactored into new open source projects
At present, the source code has been synchronized to Github( The document site is under planning , Will gradually improve ):
QQ Group :7424099
Wechat group : Plus technology operation wechat (MasaStackTechOps), Remarks , Invite in

Reprinted from :( guiguzi )
边栏推荐
- Redis overview
- Développer un opérateur basé sur kubebuilder (démarrer)
- LeetCode Algorithm 24. Exchange the nodes in the linked list in pairs
- Interpretation of cloud native microservice technology trend
- pybullet机器人仿真环境搭建 5.机器人位姿可视化
- [207] several possible causes of Apache crash
- C语言 头哥习题答案截图
- Supplement the short board - Open Source im project openim about initialization / login / friend interface document introduction
- Kept to implement redis autofailover (redisha)
- 了解下常见的函数式接口
猜你喜欢

Supplement the short board - Open Source im project openim about initialization / login / friend interface document introduction

架构实战营毕业设计

1-12Vmware新增SSH功能

MS | Xie Liwei group found that mixed probiotics and their metabolites could alleviate colitis

用Attention和微调BERT进行自然语言推断-PyTorch

对话长安马自达高层,全新产品将在Q4发布,空间与智能领跑日系

内存分区模型

Dialogue with the senior management of Chang'an Mazda, new products will be released in Q4, and space and intelligence will lead the Japanese system

构造函数和析构函数

Stm32h7b0 replaces the h750 program, causing the MCU to hang up and unable to burn the program
随机推荐
经典同步问题
STM32F103C8T6实现呼吸灯代码
基於Kubebuilder開發Operator(入門使用)
What is flush software? Is it safe to open an account online?
[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)
Leetcode 1169. 查询无效交易(如果数据量不大,这种题还是得暴力枚举解决)
MS|谢黎炜组发现混合益生菌制剂及其代谢产物可缓解结肠炎
Vibrating liquid quantity detecting device
Redis migration (recommended operation process)
[force deduction question] two point search: 4 Find the median of two positive arrays
Structure the graduation project of actual combat camp
Knowing these commands allows you to master shell's own tools
Stm32f103c8t6 realize breathing lamp code
[graduation season] a word for graduates: the sky is high enough for birds to fly, and the sea is wide enough for fish to leap
Experience in hierarchical debugging of boards and cards
Several forms of buffer in circuit
# 补齐短板-开源IM项目OpenIM关于初始化/登录/好友接口文档介绍
Exquisite makeup has become the "soft power" of camping, and the sales of vipshop outdoor beauty and skin care products have surged
C语言 头哥习题答案截图
R329 (maix-ii-a (M2A) data summary