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

feature: add single server rale limit #6756

Open
wants to merge 17 commits into
base: 2.x
Choose a base branch
from

Conversation

xjlgod
Copy link
Contributor

@xjlgod xjlgod commented Aug 14, 2024

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Support flow limiting control for a single server:

  • Flow limiting components: Select Bucket4j components to implement flow limit control.
  • Processing flow limit control: Process flow limiting at the top level in DefaultCordinator, and perform flow limiting checks in the onRequest method. Only GlobalBegin request will be limited.
  • Transaction end identity: All transaction ends need to be able to correctly identify flow limit control and throw corresponding exceptions.
  • Metrics: Use a new metrics record events when current limiting is triggered

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Copy link

codecov bot commented Aug 24, 2024

Codecov Report

Attention: Patch coverage is 46.74556% with 90 lines in your changes missing coverage. Please review.

Project coverage is 52.27%. Comparing base (9263976) to head (c01b24f).
Report is 3 commits behind head on 2.x.

Files with missing lines Patch % Lines
...va/org/apache/seata/core/event/RateLimitEvent.java 0.00% 23 Missing ⚠️
...che/seata/server/ratelimit/TokenBucketLimiter.java 45.71% 19 Missing ⚠️
...e/properties/server/ServerRateLimitProperties.java 7.69% 12 Missing ⚠️
...e/seata/server/coordinator/DefaultCoordinator.java 9.09% 9 Missing and 1 partial ⚠️
...che/seata/server/ratelimit/RateLimiterHandler.java 56.52% 9 Missing and 1 partial ⚠️
...handler/GlobalTransactionalInterceptorHandler.java 0.00% 3 Missing ⚠️
...ava/io/seata/tm/api/DefaultFailureHandlerImpl.java 0.00% 2 Missing ⚠️
...ga/engine/tm/DefaultSagaTransactionalTemplate.java 0.00% 2 Missing ⚠️
...zer/seata/protocol/AbstractResultMessageCodec.java 0.00% 0 Missing and 2 partials ⚠️
...org/apache/seata/tm/DefaultTransactionManager.java 0.00% 2 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6756      +/-   ##
============================================
- Coverage     52.31%   52.27%   -0.04%     
- Complexity     6375     6394      +19     
============================================
  Files          1078     1083       +5     
  Lines         37483    37648     +165     
  Branches       4440     4451      +11     
============================================
+ Hits          19608    19681      +73     
- Misses        15938    16026      +88     
- Partials       1937     1941       +4     
Files with missing lines Coverage Δ
...ava/org/apache/seata/common/ConfigurationKeys.java 0.00% <ø> (ø)
...seata/core/exception/TransactionExceptionCode.java 100.00% <100.00%> (ø)
...ava/org/apache/seata/core/protocol/ResultCode.java 100.00% <100.00%> (ø)
...ta/spring/boot/autoconfigure/StarterConstants.java 100.00% <ø> (ø)
.../apache/seata/server/metrics/MeterIdConstants.java 100.00% <100.00%> (ø)
.../apache/seata/server/metrics/MetricsPublisher.java 94.73% <100.00%> (+0.98%) ⬆️
...apache/seata/server/metrics/MetricsSubscriber.java 21.70% <100.00%> (+7.29%) ⬆️
...g/apache/seata/server/ratelimit/RateLimitInfo.java 100.00% <100.00%> (ø)
...org/apache/seata/tm/api/TransactionalExecutor.java 65.51% <100.00%> (+1.23%) ⬆️
...configure/SeataServerEnvironmentPostProcessor.java 0.00% <0.00%> (ø)
... and 12 more

... and 4 files with indirect coverage changes

@slievrly slievrly self-requested a review August 31, 2024 14:51
@slievrly slievrly added this to the 2.3.0 milestone Aug 31, 2024
@funky-eyes funky-eyes added type: feature Category issues or prs related to feature request. module/server server module labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/server server module type: feature Category issues or prs related to feature request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants