Open yuweibo opened 5 years ago
Hi, thanks for your suggestion. We might need to redesign the push-based data source to use one connection for all kinds of rules. Discussions and contributions are welcomed :)
after change,it's compatible with older versions.
I have an idea to return multiple data sources in one connection. The key to having multiple data sources on the same link is that their zkClient is the same object. ZookeeperDataSource has defined the zkClient property if you add a constructor
ZookeeperDataSource(final CuratorFramework zkClient, final String path, Converter<String, T> parser)
zkClient can be passed in externally so that function extensions can be implemented. This change point is very small, I have already implemented it locally.
In order to facilitate the upgrade and maintenance in the future, I suggest that it is best not to use the new ZookeeperDataSource method to create a data source, instead use the factory mode method to create, for example
com.alibaba.csp.sentinel.datasource.zookeeper.ZookeeperDataSourceFactory#createDataSource(java.lang.String, java.lang.String[], com.alibaba.csp.sentinel.datasource.Converter<java.lang.String,T> )
This way we can seamlessly upgrade when we switch the creation method.
hi, i find a way to fix this problem and i will offer a PR latter
This has been resolved via a temporary solution: #788
But we need further discussion for the design of data-source (see #649)
Issue Description
Type: bug report
Describe what happened (or what feature you want)
zookeeper server connections has increased five-fold
Describe what you expected to happen
4 rules one connection enough
How to reproduce it (as minimally and precisely as possible)