GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [feature][transaction] Add a configuration to control max active transaction of coordinator by congbobo184 · Pull Request #15157 · apache/pulsar

Conversation

@congbobo184

@congbobo184 congbobo184 commented Apr 13, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

detail in #15133

  • Status: Discussion
  • Author: Bo Cong
  • Pull Request:
  • Mailing List discussion:
  • Release: 2.11

Motivation

Currently, the transaction coordinator does not limit the number of active transactions, which may cause the following problems:

  • A large number of active transactions will put a lot of pressure on memory
  • The transaction that a single TC can handle is limited, so the active transaction cannot be expanded infinitely
  • End transaction should wait TP or TB recover success, so a lot end request will pending in TP or TB and TC don't kown the state of the TB or TP, it will wast a lot of resource of the machine. If there have a lot of TB or TP request in pending state, it will cause the OOM

Implementation

Add config

add maxActiveTransactions into broker.conf

# The max active transactions in one transaction coordinator
maxActiveTransactionsPerCoordinator=10000

How to handle the number of active transactions reach the maxActiveTransactions?

If reach the maxActiveTransactions, return the Exception to client. It has a lot of disadvantages:

  1. broker should add a ReachMaxActiveTxnException, if reach the max active txn exception. client need try this exception then do op. every client will handle the ReachMaxActiveTxnException.
  2. client receive this transaction will not stop open txn, because it don't know what time the TC will be recoverd. It will retry now. When the TC can't recover, the client will keep retrying. But this op is not make sense.

Design

When this op request reach the maxActiveTransactions, coordinator don't return any response for this request. ignore this request directly. In this way, broker don't need to add any exception for this config.

Let's we can see, how does this way will affect the client?

If broker don't return the reponse for this request, the op of open txn will timeout. and in coordinator client, it has a semaphore to control the op of txn(open, add produce topic, add ack topic, end txn). In the timeout time, the coordinator client only can open the number of semaphore txns. Any other request will be block. So this design slove this two problems:

  1. don't need to add a exception
  2. client will not infinite retry

Worries

If you are worried that this design will affect the client-side experience, because the open transaction will always time out and other txn op will be blocked. I think your worry is superfluous, At this time, you should consider increasing the performance of the cluster or find the problematic client to repair.

flow chart

image

Compatibility, Deprecation, and Migration Plan

maxActiveTransactions default = 0, if maxActiveTransactions will not block open txn

Test Plan

reach maxActiveTransactions client open txn will timeout

Rejected Alternatives

If reach the maxActiveTransactions, return the Exception to client. It has a lot of disadvantages:

  1. broker should add a ReachMaxActiveTxnException, if reach the max active txn exception. client need try this exception then do op. every client will handle the ReachMaxActiveTxnException.
  2. client receive this transaction will not stop open txn, because it don't know what time the TC will be recoverd. It will retry now. When the TC can't recover, the client will keep retrying. But this op is not make sense.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
congbo added 4 commits April 13, 2022 16:43
congbo
[future][txn] Add max active txn config in transaction coordinator
056fc31
congbo
Add doc
3e5f983
congbo
Fix some code style
2e53f96
congbo
Add some test
7ad48f5
@congbobo184 congbobo184 added area/config area/transaction component/transaction-coordinator doc-complete Your PR changes impact docs and the related docs have been already added. labels Apr 13, 2022
@congbobo184 congbobo184 added this to the 2.11.0 milestone Apr 13, 2022
@congbobo184
congbobo184 requested review from Technoboy-, codelipenghui, eolivelli and gaoran10 April 13, 2022 09:11
@congbobo184 congbobo184 self-assigned this Apr 13, 2022
@gaozhangmin gaozhangmin changed the title Congbobo184 add max active transaction limitation [feature][transaction] Add a configuration to control max active transaction of coordinator Apr 13, 2022
@RobertIndie RobertIndie added the type/feature The PR added a new feature or issue requested a new feature label Apr 13, 2022
liangyepianzhou
liangyepianzhou approved these changes Apr 13, 2022
View reviewed changes

@liangyepianzhou liangyepianzhou left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@HQebupt

HQebupt commented Apr 14, 2022

Copy link
Copy Markdown
Contributor

LGTM :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

HQebupt
HQebupt approved these changes Apr 14, 2022
View reviewed changes
@congbobo184 congbobo184 mentioned this pull request Apr 15, 2022
Max active transaction limitation for transaction coordinator streamnative/pulsar-archived#4075
Closed
congbo
Merge remote-tracking branch 'apache/master' into congbobo184_add_max…
2641c74
…_active_transaction_limitation
@github-actions

github-actions Bot commented May 19, 2022

Copy link
Copy Markdown

The pr had no activity for 30 days, mark with Stale label.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the lifecycle/stale label May 19, 2022
congbobo184 added 5 commits May 30, 2022 18:43
congbobo184
Merge branch 'master' into congbobo184_add_max_active_transaction_lim…
6bfcaee
…itation

# Conflicts:
#	conf/broker.conf
#	pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
#	site2/docs/reference-configuration.md
congbobo184
fix conflic
a622555
congbobo184
Merge branch 'bewaremypower/last-cumulative-ack' of https://github.co…
7258151
…m/BewareMyPower/pulsar into bewaremypower/last-cumulative-ack

# Conflicts:
#	pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java
congbobo184
Merge remote-tracking branch 'apache/master' into congbobo184_add_max…
a5bd06b
…_active_transaction_limitation
congbobo184
fix some tests
57d0c7b
gaoran10
gaoran10 reviewed Jun 24, 2022
View reviewed changes
Comment thread ...src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java Outdated

@FieldContext(
category = CATEGORY_TRANSACTION,
doc = "The max active transactions per transaction coordinator."

@gaoran10 gaoran10 Jun 24, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
doc = "The max active transactions per transaction coordinator."
doc = "The max active transactions per transaction coordinator, default value 0 indicates no limit."

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gaoran10
gaoran10 reviewed Jun 24, 2022
View reviewed changes
Comment thread conf/broker.conf Outdated
# The max concurrent requests for transaction buffer client, default is 1000
transactionBufferClientMaxConcurrentRequests=1000

# The max active transactions per transaction coordinator

@gaoran10 gaoran10 Jun 24, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
# The max active transactions per transaction coordinator
# The max active transactions per transaction coordinator, default value 0 indicates no limit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
congbobo184
fix some comment
aaa3df6
gaoran10
gaoran10 approved these changes Jun 24, 2022
View reviewed changes

@gaoran10 gaoran10 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@congbobo184
congbobo184 merged commit 7bf7736 into apache:master Jun 27, 2022
@congbobo184 congbobo184 mentioned this pull request Jul 15, 2022
[PIP 154] Max active transaction limitation for transaction coordinator #15133
Closed
@tisonkun tisonkun removed the component/transaction-coordinator label Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@HQebupt HQebupt HQebupt approved these changes
@gaoran10 gaoran10 gaoran10 approved these changes
@liangyepianzhou liangyepianzhou liangyepianzhou approved these changes
@Technoboy- Technoboy- Awaiting requested review from Technoboy-
@eolivelli eolivelli Awaiting requested review from eolivelli
@codelipenghui codelipenghui Awaiting requested review from codelipenghui

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@congbobo184 congbobo184

Labels

area/config area/transaction doc-complete Your PR changes impact docs and the related docs have been already added. lifecycle/stale type/feature The PR added a new feature or issue requested a new feature

Projects

None yet

Milestone

2.11.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@congbobo184 @HQebupt @gaoran10 @liangyepianzhou @RobertIndie @tisonkun
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.