Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default cluster flow control implementation #294

Merged
merged 21 commits into from
Dec 14, 2018

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Dec 10, 2018

Describe what this PR does / why we need it

Add default cluster flow control implementation.

Does this pull request fix one issue?

Closes #293

Also related to #207

Describe how you did it

// TBD: detailed design and description notes

Architecture overview (transport):

cluster-arch-transport

Describe how to verify it

See test cases and demo.

Special notes for reviews

This is a very large PR containing features of multiple modules. It's NOT a good idea to submit such a large PR, but it's hard to separate this into small branches.

@sczyh30 sczyh30 added the to-review To review label Dec 10, 2018
@codecov-io
Copy link

codecov-io commented Dec 13, 2018

Codecov Report

Merging #294 into master will decrease coverage by 7.55%.
The diff coverage is 2.84%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #294      +/-   ##
============================================
- Coverage     45.78%   38.23%   -7.56%     
- Complexity      921      930       +9     
============================================
  Files           181      219      +38     
  Lines          5753     6921    +1168     
  Branches        832      939     +107     
============================================
+ Hits           2634     2646      +12     
- Misses         2787     3941    +1154     
- Partials        332      334       +2
Impacted Files Coverage Δ Complexity Δ
...tinel/slots/statistic/metric/MetricsLeapArray.java 100% <ø> (ø) 3 <0> (ø) ⬇️
...p/sentinel/slots/statistic/metric/ArrayMetric.java 64.28% <ø> (ø) 20 <0> (ø) ⬇️
...ster/server/codec/data/FlowResponseDataWriter.java 0% <0%> (ø) 0 <0> (?)
...luster/server/codec/netty/NettyRequestDecoder.java 0% <0%> (ø) 0 <0> (?)
...luster/flow/statistic/ClusterMetricStatistics.java 0% <0%> (ø) 0 <0> (?)
...ter/server/processor/RequestProcessorProvider.java 0% <0%> (ø) 0 <0> (?)
...l/cluster/server/log/ClusterServerStatLogUtil.java 0% <0%> (ø) 0 <0> (?)
...mmand/handler/FetchClusterServerConfigHandler.java 0% <0%> (ø) 0 <0> (?)
...ster/server/config/ClusterServerConfigManager.java 0% <0%> (ø) 0 <0> (?)
...ster/server/codec/DefaultResponseEntityWriter.java 0% <0%> (ø) 0 <0> (?)
... and 151 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 512b27b...465b44b. Read the comment docs.

- Add a universal `TokenService` SPI interface for both local flow control and distributed flow control
- Add TokenResult entity to represents result of acquiring token
- Add `ClusterTokenClient` as the SPI interface for client of Sentinel cluster flow control

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add new field `clusterMode` and `clusterConfig` for cluster mode
- Add a `ClusterFlowConfig` class for specific items for cluster flow control
- Update FlowRuleChecker to support cluster mode
- Extract valid rule checking and rule map generating logic to FlowRuleUtil

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
…util class

- Update ParamFlowRule to support cluster mode
- Add `ParamFlowClusterConfig` to provide cluster mode items for the rule
- Update ParamFlowChecker to support cluster flow mode
- Extract ParamFlowRuleUtil class
- Change type of `flowId` from Integer to Long

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add a `ClusterTransportClient` for transport abstraction of Sentinel cluster
- Add universal request/response interface and common ClusterRequest/ClusterResponse abstraction
- Add common request/response data entity
- Add basic abstraction of codec (EntityWriter and EntityDecoder)

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add Netty transport client implementation and default cluster token client
- Add config manager for cluster client
- Add codec SPI mechanism for client entity decoder / writer

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add `start` and `stop` method for automatic control
- Update TokenClientProvider using SpiLoader

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add a EmbeddedClusterTokenServer interface

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Remove "borrow-from-ref" mode
- Improve flow checker to support both embedded server mode and client mode

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add a `@RequestType` annotation for common use (e.g. request handler, encoder or decoder)
- Add a registry for universal config supplier (e.g. namespace of client)

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add exception item extracting method in ParamFlowRule

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Initial work

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add several command handlers
- Update cluster state manager

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
…cluster module

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@sczyh30 sczyh30 force-pushed the feature/cluster-flow-control branch from d112ed1 to f01fe2b Compare December 14, 2018 02:54
Copy link
Contributor

@CarpenterLee CarpenterLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 merged commit fba114d into master Dec 14, 2018
@sczyh30 sczyh30 removed the to-review To review label Dec 14, 2018
@sczyh30 sczyh30 deleted the feature/cluster-flow-control branch December 24, 2018 14:27
Arlmls pushed a commit to Arlmls/Sentinel that referenced this pull request Jan 8, 2019
- Add default cluster flow control implementation
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
…sg when… (alibaba#294)

* Fix issue : duplicate compress message body if retry to send msg when  exception occurs in async sending.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Default cluster flow control implementation
3 participants