Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PIE-1707] Implement a timeout in TransactionMessageProcessor #1604

Conversation

AbdelStark
Copy link
Contributor

PR description

In order to avoid the transaction pool to grow unbounded, a maximum capacity has been implemented in #1586. This follow up PR enable to skip processing a transaction if too old.

  • processTransactionsMessage now takes a keepAlive parameter
  • don't process the message if expired
  • add unit tests
  • use a default timeout for transactions (1 minute)

Fixed Issue(s)

- `processTransactionsMessage` now takes a `keepAlive` parameter
- don't process the message if expired
- add unit tests
- use a default timeout for transactions (1 minute)
final Instant startedAt,
final Duration keepAlive) {
// Check if message not expired.
if (startedAt.plus(keepAlive).isAfter(now())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you provide any log or some feedback in case you skip the message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No because potentially we will drop thousands of messages and logging would be a bottleneck. A potential follow up PR would gather information and maintain a counter as a prometheus metric to see the total number of dropped messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will create a follow up PR after this one to keep it small.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed in #1586 we have to deal with up to 500 tx / second. We want to drop oldest messages because they are more likely to contain non relevant transactions. So we check if the message has expired prior to process it. Since we would probably have to skip thousands of messages we don't want to log each individual message skipped. A follow up PR will be created after this one to ensure we have proper feedback.

…transactions/TransactionsMessageProcessorTest.java

Co-Authored-By: Nicolas MASSART <[email protected]>
Copy link
Contributor

@mbaxter mbaxter left a comment

Choose a reason for hiding this comment

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

LGTM

@AbdelStark AbdelStark merged commit 45e35da into PegaSysEng:master Jun 25, 2019
@AbdelStark AbdelStark deleted the feature/pie-1707-tx-msg-processor-timeout branch June 26, 2019 15:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants