当前位置:网站首页>How does IOT platform realize business configuration center
How does IOT platform realize business configuration center
2022-04-21 18:12:00 【Huawei cloud developer community】
Abstract : This article describes the business configuration center ( The following is a brief description of the configuration center ) The key technology and implementation of .
This article is shared from Huawei cloud community 《 Teach you how the IOT platform can realize the business configuration center 》, author : Hua Wei Yun IoT The panel of experts .
Last one 《 Huawei cloud Internet of things advanced siege lion 4 Practice sharing of configuration center in 》 The article shares the business configuration center .
This article describes the business configuration center ( The following is a brief description of the configuration center ) The key technology and implementation of . Huawei cloud Internet of things platform implements a business configuration center according to the implementation method in this paper , This configuration center 2020 year 1 Monthly online , Smooth operation up to now .
1 Concept
1.1 Operation and maintenance configuration
It's not about users , It is usually configured at the cluster boundary level , The program will only read , Such as database configuration 、 Mailbox server configuration 、 Network card configuration 、 Subnet address configuration, etc .
1.2 Business configuration
As SaaS service , Each user has some business configuration on it . Such as the user's certificate configuration 、 Flow control configuration of user server, etc , These business configurations are relatively Operation and maintenance configuration It's more complicated for me , And there may be uniqueness restrictions , By user id only . This part of configuration data is usually triggered by user operation , Dynamic code writing , And notify each microservice instance . Usually , We hope that these configurations can be displayed in the interface , And support artificial modification . If the above logic is implemented by each micro service itself , There will be a lot of duplicate code , And there's no guarantee of quality . We want a common component to unify this capability . Open source or smaller projects will not choose to rely on a configuration center , But directly through the connection to the database or etcd To solve the problem .
1.3 env
Represents a deployment environment .
1.4 cluster
Represents the cluster in the environment . It is common for blue-green publishing in a single environment , Blue cluster 、 Green clusters 、 Canary clusters, etc .
1.5 To configure
Configuration name , Such as user certificate configuration 、 User flow control configuration, etc .
1.6 Key
Unique key for configuration , Such as user id.
1.7 Value
Configure the value corresponding to the only key .
2 Configuration center design outline
2.1 Business configuration features
- Although there may be concurrency in business configuration writing , But the amount of concurrency is small , The frequency is low .
- Business configuration is often user-oriented id, The number of users in a single cluster is limited , Generally not more than 5 ten thousand .
2.2 Problems to be solved by the configuration center

2.3 Design points
- Single configuration requires configuration id, Every id through version Optimistic concurrency control to solve the problem of multi version conflict
- Notice is not reliable , When the application and configuration center are disconnected and cannot receive notifications , Ensure the reliability of data by regularly synchronizing data
- Support Schema Changes , because Schema Change infrequently , Also used version Optimistic concurrency control to solve the problem of multi version conflict
2.4 Whether the notification contains message content
I think we should only inform Key, The specific values let the application go to the configuration center to query . Just notice Key The implementation is simple and easy to understand . Notice at the same time Key&Value It is necessary to consider the two channels of periodic synchronization and notification concurrency , Possible race conflicts .
3 Configure the business process of the center
This section describes all business processes of the business configuration center , And try to abstract the interface irrelevant to the concrete implementation from the interaction
3.1 Add, delete, modify and check the configuration

3.2 Addition, deletion, modification and query of configuration value

3.3 Synchronize regularly
In the distributed environment , The notice may not be delivered , If the program falls into network interruption ( Or long gc), Notification message delivery timeout , After the program is restored , The data is no longer accurate . Therefore, the data needs to be synchronized regularly , Improve reliability .

During synchronization , Just request interaction id and version, Avoid transmitting large amounts of data . After the application receives the data that needs to be synchronized :
- Delete operation , Trigger deletion notification , Remove data from local cache .
- add to 、 Modify the operating , Query the configuration center for the latest data , Trigger notification and write to local cache .
3.4 Service startup
Service startup can also be regarded as a synchronous process , Just need to synchronize a large number of data additions . In order to avoid frequent and large requests to the configuration center , Introduce batch operation to reduce pressure

3.5 Limit
The design idea of the configuration center relies on the client to put all the data into the memory , If the number of users is too large , This model is not suitable .
notes : One way to save memory is , Only a full amount of... Is placed in memory id and version, Data can only be queried when needed . This idea requires the configuration center to persist some old data for query in the following scenarios
- In the business process , You need to use this configuration value .
- When the callback business program is modified , Need to provide the old value .
There is no other difference .
4 Abstract implementation of business configuration
From the business scenario described above , We abstract the interactive interface and abstract implementation of the business configuration center . Interface Swagger Yaml Uploaded to Github:https://github.com/Shoothzj/config-center/tree/master/swagger
4.1 Configure relevant interfaces
- Provide env、cluster、 Configuration name 、 To configure Schema、 Add configuration version number
- Provide env、cluster、 Configuration name delete configuration
- Provide env、cluster、 Configuration name 、 new Schema、 new Version To modify the configuration
- Provide env、cluster、 The configuration name is used to query the configuration
4.2 Configuration value related interface
- Provide env、cluster、 Configuration name 、Key、Value To add configuration values
- Provide env、cluster、Key、ValueVersion( Optional ) To delete the configuration value
- Provide env、cluster、Key、Value、ValueVersion( Optional ) Modify configuration values
- Provide env、cluster、Key Query the configuration value
- according to env、cluster、 The current configuration data of the application is used for periodic synchronization
- according to Key List batch query configuration values
4.3 Notify relevant interfaces
- Notify a env some cluster Next , One of the configuration items Key change , newly added 、 Modify or delete . The options are HTTP Long link (Inspired by Apollo)、Mqtt、WebSocket etc. .
4.4 Configuration center storage layer Abstract implementation
The configuration center storage tier requires storage To configure and Configuration values data , Support UpdateByVersion, And need to capture changes in data , Used to notify the application
4.5 Abstract implementation of service discovery
In order to connect the application to the configuration center , A discovery mechanism is needed to make the application aware of the address of the configuration center . There are many ways of high availability , Such as K8s Find out 、ZooKeeper、Etcd、ServiceComb、 Business environment variable injection ELB Address (ELB The address of the backend mount configuration center ) etc. .

4.6 Abstract summary
According to this abstraction , We can select the key technical points , To implement the business configuration center .
5 Configuration center implementation
5.1 Huawei cloud Internet of things configuration center realizes

- env+cluster+config The name of the data table
- One key、value Corresponding to a row of data
5.2 Another way to do it
As long as the above interfaces and abstraction capabilities are implemented , Business configuration center can be realized , It can also be achieved

- env+cluster+config+key Combine into etcd Of key
- One key、value Corresponding to a key value pair
5.3 Another implementation
Of course

- env+cluster+config+key Combine into RocksDB Of key
- One key、value Corresponding to a key value pair
Click to follow , The first time to learn about Huawei's new cloud technology ~
版权声明
本文为[Huawei cloud developer community]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211807241789.html
边栏推荐
- 【无标题】
- Q:excel制作折线图
- Logstash ~ logstash command line optional parameters
- String(一个特殊的数据类型)
- 一个通用的CommonDialog
- Google has been unable to collect the transformation target on the mobile terminal. What's the matter?
- MySQL——远程连接非本地MySQL数据库服务器,报错ERROR 1130: Host 192.168.3.100 is not allowed to connect to this MySQL s
- 离散数学 命题逻辑
- Debugging garbled code of vs2019 visual studio terminal
- 爬虫案例01
猜你喜欢

【无标题】

laravel-soar(2.x) - 自动监控输出 SQL 优化建议、辅助 laravel 应用 SQL 优化

The conflict between Russia and Ukraine raised concerns. The five eye network security department suggested that allies strengthen the protection of key infrastructure

Detailed explanation of kubernetes (III) -- kubernetes cluster components

上位机这样玩,才有意思!

靶机渗透练习80-Momentum:1

移动平台WorkPlus集成化办公,打造企业全场景业务生态

不同研发协作模式在云效中的应用

【acwing】1118. 分成互质组 ***(DFS)

【acwing】166. 数独****(DFS)
随机推荐
The upper computer is fun to play like this!
"Industrial Internet plus safety production" to enhance the safety level of industrial enterprises
【acwing】166. 数独****(DFS)
How can the manufacturing industry save itself under the crisis of insufficient personnel and broken supply chain?
上位机这样玩,才有意思!
看看项目经理是如何把一个项目带崩的
STM32单片机内存管理器代码,可直接用于工程
看看技术宅怎么拯救学霸机,我用10块钱修好了笔记本电脑
Logstash ~ output of logstash
ansible简单使用示例
Variable与Tensor合并后,关于训练、验证的相关变化
Weekly recommended short video: the competition between enterprises is to see who can seize the first opportunity
fastjson自动升级成fastjson2后 IDEA开发环境正常 打成jar包发布生成环境后报错异常 pom.xml的version自动升级导致
靶机渗透练习71-DC3
封装的JDBC工具
单片机能做什么,你有什么有单片机或开源硬件做的有意思的作品吗
A common CommonDialog
Mycat水平分表(E-R表)
Finally someone made it clear! It turns out that this is the global one-piece network technology with low delay
Detailed explanation of kubernetes (IV) -- kubernetes deployment based on kubedm