当前位置:网站首页>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 )
边栏推荐
- Niuke Xiaobai monthly race 50
- Failed to upload hyperf framework using alicloud OSS
- The student record consists of student number and academic performance. The data of n students have been stored in the a structure array to find out the student record with the lowest performance
- Greenplum数据库故障分析——semop(id=2000421076,num=11) failed: invalid argument
- Calculate the average of N numbers in the index group of X, and return the number that is less than the average and closest to the average through formal parameters
- Redis migration (recommended operation process) 1
- What is the preferential account opening policy of securities companies now? Is it safe to open an account online now?
- 牛客编程题--必刷101之动态规划(一文彻底了解动态规划)
- 探讨:下一代稳定币
- proxy
猜你喜欢

数字藏品与NFT到底有何区别

Natural language inference with attention and fine tuning Bert pytorch

Junit单元测试

Gui+sqlserver examination system

经典同步问题

Kubecon China 2021 Alibaba cloud special session is coming! These first day highlights should not be missed

Cuckoo filter for Chang'an chain transaction

Summary of all knowledge points of C language

TCP congestion control details | 1 summary

【力扣刷题】二分查找:4. 寻找两个正序数组的中位数
随机推荐
Redis Guide (8): principle and implementation of Qianfan Jingfa distributed lock
Pybullet robot simulation environment construction 5 Robot pose visualization
最小二乘系统辨识课 中篇:递归最小二乘
Natural language inference with attention and fine tuning Bert pytorch
国内首款开源 MySQL HTAP 数据库即将发布,三大看点提前告知
【小5聊】毕业8年,一直在追梦的路上
Count the number of words in a line of string and take it as the return value of the function
安信证券排名第几位?开户安全吗?
Memory partition model
基于Kubebuilder开发Operator(入门使用)
I regard it as a dry product with a monthly income of more than 30000 yuan for sidelines and more than 10000 yuan for novices!
知道这几个命令让你掌握Shell自带工具
我把它当副业月入3万多,新手月入过万的干货分享!
Niuke Xiaobai monthly race 50
Knowing these commands allows you to master shell's own tools
JS tutorial using electron JS build native desktop application ping pong game
【从删库到跑路】JDBC 完结篇(一天学完系列!!学完赶紧跑!)
【力扣刷题】单调栈:84. 柱状图中最大的矩形
Calculate the average of N numbers in the group indexed by the formal parameter x, move the data less than the average in the group indexed to the front of the array, and move the data greater than or
5G未平6G再启,中国引领无线通信,6G的最大优势在哪里?