-
Notifications
You must be signed in to change notification settings - Fork 150
MC-13864: Consumer always read config from memory #91
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e04c2b1
MC-13864: Consumer always read config from memory
vzabaznov 69e1a53
Update poison-pill.md
vzabaznov 1e7ee95
Update poison-pill.md
vzabaznov b05689a
Update poison-pill.md
vzabaznov 31062a6
MC-13864: Consumer always read config from memory
vzabaznov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ## Glossary | ||
|
|
||
| poison pill | ||
| : message that added after list of events in Data Storage that signals that consumer should die. | ||
|
|
||
| ### Overview | ||
|
|
||
| Right now our consumer depends on config/objects in-memory state. After application was bootstrapped it initialize a lot of object that are always kept in memory after first load - config, websites, etc.., since our consumers are long-living and their live time limited only by message count it could happens that our consumer keep outdated im-memory config/objects states. Considering that, we need to introduce the way to reinit them. | ||
|
|
||
| ### Design | ||
|
|
||
| Basic implementation of how the pill will be added should be implemented inside Magento Framework. We will share the api that let each module call whenever it needed. | ||
|
|
||
| Api Interface - *PoisonPillInterface* will be inside Magento Framework, implementation in MessageQueue module. | ||
|
|
||
| PoisonPillInterface | ||
| ```php | ||
| /** | ||
| * Put poison pill inside DB. | ||
| * | ||
| * @throws \Exception | ||
| * @return int | ||
| */ | ||
| public function put(); | ||
| ``` | ||
|
|
||
| Before process new message, consumer will compare version of PoisonPill in-memory state with latest in DB. If version is different consumer dies and next cron:run will start new instance of consumer. | ||
|
|
||
| #### Acceptance Criteria Fulfillment | ||
|
|
||
| 1. If consumer takes message to process after poison pill was placed, consumer must be reinited. | ||
|
|
||
| #### Extension Points and Scenarios | ||
|
|
||
| We will put poison pill into Data Storage based on common Magento extension points. | ||
|
|
||
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.
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.
Does it mean that there will be at least one MySQL DB query for each consumed message?
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.
Yes
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.
Please add warning to the design document for the team implementing this feature to verify performance implications.
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.
@paliarush @vzabaznov I am concerned about this point specifically, if for each read we are hitting the database query, then what is the purpose of storing configurations in-memory? we might lose the benefits of in-memory optimizations. We should think differently here, on invalidating the cache on event based.