alibaba / Sentinel

A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)
https://sentinelguard.io/
Apache License 2.0
22.39k stars 8.02k forks source link

Zookpeer dynamic rule persistence discussion #753

Open linlinisme opened 5 years ago

linlinisme commented 5 years ago

在做zookeeper规则持久化我发现一种类型规则只能注册一个data Source。 这样当我对应用的某个资源进行规则配置时,我想先定义一个公共的默认配置,到时再根据实际情况调整具体机器上的配置。

举个例子: resource A : 公共配置QPS 10。即所有机器上的A的默认QPS是10。 因为机器1配置高,修改为20 QPS,机器2上面的换成 5 QPS。

因为RuleManager.register只能注册一个data Source,一个data Source 对应 一个Zookeeper节点。公共的默认配置与具体机器的配置中放不同Zookeepr节点 。所以现在要么只能持久化公共的默认配置,要么只能持久化具体机器的配置,两个不能同时通过RuleManager.register持久化。

我有一个想法就是RuleManager.register改成可注册多个data Source,这样公共默认配置和具体配置都可以持久化,不知道大家觉得怎样。

关于持久化我还有一个想法就是将来可以换成不改造dash board方式。dash board仅仅是一个客户端,只提供curd的入口API,业务逻辑放在sentinel server端完成 。sentinel server端提供数据源接入方法,接入者实现规则write与read的方法即可。这样切换持久化数据源时,dash board不需要再动一次。欢迎大家讨论。

sentinel-bot commented 5 years ago

Hi @linlinisme, we detect non-English characters in the issue. This comment is an auto translation from @sentinel-bot to help other users to understand this issue. We encourage you to describe your issue in English which is more friendly to other users.

Zookpeer dynamic rule persistence discussion

In doing zookeeper rule persistence I found that a type rule can only register one data source. So when I configure the rules for a certain resource of the application, I want to define a common default configuration, and then adjust the configuration on the specific machine according to the actual situation.

for example: Resource A : Public configuration QPS 10. That is, the default QPS of A on all machines is 10. Because machine 1 is configured high, it is modified to 20 QPS, and machine 2 is replaced with 5 QPS.

Because RuleManager.register can only register one data source, one data source corresponds to one Zookeeper node. The common default configuration is different from the configuration of the specific machine in the Zoocreper node. So now either you can only persist the public default configuration, or you can only persist the configuration of a specific machine, and the two cannot be persisted through RuleManager.register at the same time.

I have an idea that RuleManager.register can be changed to register multiple data sources, so that the public default configuration and specific configuration can be persisted. I don't know what everyone thinks.


I still have an idea about persistence. In the future, I can change it to a method that does not transform the dash board. The dash board is just a client. It only provides the portal API for the curve. The business logic is placed on the sentinel server. The sentinel server provides a data source access method, and the accessor implements the rules write and read methods. When switching persistent data sources in this way, the dash board does not need to be moved again. Welcome everyone to discuss.

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

Anything else we need to know?

jasonjoo2010 commented 5 years ago

I try to contribute some thoughts on it.

Weight

It is a responsibility of Gateway/RPC framework like Nginx/Dubbo. They should support distributing flow by weight to different upstreams or remotes.

Different Thresholds

Maybe we can give a maximum per node and mainly through Cluster Flow Rule to control the global ability of system.

After all it's a difficult task to do that if the nodes are dynamically online/offline.