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

feat(s3stream): lock scope optimization and persistence settings encapsulation #1715

Closed
wants to merge 5 commits into from

Conversation

CLFutureX
Copy link
Contributor

@superhx
Copy link
Collaborator

superhx commented Aug 2, 2024

In the future, the WAL plan will be changed to a sequential success model to improve code maintainability while meeting current performance requirements.

This PR increases the consideration cost for concurrent scenarios, and it is not recommended to over-optimize in scenarios without performance issues.

@CLFutureX
Copy link
Contributor Author

CLFutureX commented Aug 2, 2024

In the future, the WAL plan will be changed to a sequential success model to improve code maintainability while meeting current performance requirements.

This PR increases the consideration cost for concurrent scenarios, and it is not recommended to over-optimize in scenarios without performance issues.

Yeah, I agree with your point. But for this PR specifically, the performance improvement is indeed an added bonus. I think what's more significant is the improvement in code maintainability achieved by cohesively incorporating the persistence behavior into the object itself and decoupling the persistence operations from the ack response handling.

@CLFutureX CLFutureX changed the title feat(s3stream):Separate persistence settings from response handling feat(s3stream): separate persistence settings from response handling Aug 2, 2024
@CLFutureX
Copy link
Contributor Author

In the future, the WAL plan will be changed to a sequential success model to improve code maintainability while meeting current performance requirements.

This PR increases the consideration cost for concurrent scenarios, and it is not recommended to over-optimize in scenarios without performance issues.

Well, tactually for this PR, the performance improvement is more of an add-on. I think what's more important is to cohesively incorporate the persistence behavior into the object itself and separate the operations.

In the future, the WAL plan will be changed to a sequential success model to improve code maintainability while meeting current performance requirements.

This PR increases the consideration cost for concurrent scenarios, and it is not recommended to over-optimize in scenarios without performance issues.

Hey, I've given it some thought and made further optimizations. I've moved the persistence operation back into the 'after' method, which indeed makes more sense. Additionally, I mainly adjusted the scope of the locking.

@CLFutureX CLFutureX changed the title feat(s3stream): separate persistence settings from response handling feat(s3stream): lock scope optimization and persistence settings encapsulation Aug 3, 2024
# Conflicts:
#	s3stream/src/main/java/com/automq/stream/s3/S3Storage.java
}
for (WalWriteRequest waitingAckRequest : waitingAckRequests) {
waitingAckRequest.record.retain();
boolean full = deltaWALCache.put(waitingAckRequest.record);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently, LogCache relies on external guarantees to put individual Stream Records in order, moving the lock to WALCallbackSequencer#after will have thread concurrency safety issues.

@superhx
Copy link
Collaborator

superhx commented Aug 3, 2024

In the future, the WAL plan will be changed to a sequential success model to improve code maintainability while meeting current performance requirements.
This PR increases the consideration cost for concurrent scenarios, and it is not recommended to over-optimize in scenarios without performance issues.

Yeah, I agree with your point. But for this PR specifically, the performance improvement is indeed an added bonus. I think what's more significant is the improvement in code maintainability achieved by cohesively incorporating the persistence behavior into the object itself and decoupling the persistence operations from the ack response handling.

I have created an #1718 about optimizing WAL sequential callbacks. It would be the first step to make the AutoMQ storage layer code more concise. If you are interested, I would greatly appreciate it if you would take it.

Next, we can continue to optimize the concurrency issues in S3Storage.

@CLFutureX
Copy link
Contributor Author

In the future, the WAL plan will be changed to a sequential success model to improve code maintainability while meeting current performance requirements.
This PR increases the consideration cost for concurrent scenarios, and it is not recommended to over-optimize in scenarios without performance issues.

Yeah, I agree with your point. But for this PR specifically, the performance improvement is indeed an added bonus. I think what's more significant is the improvement in code maintainability achieved by cohesively incorporating the persistence behavior into the object itself and decoupling the persistence operations from the ack response handling.

I have created an #1718 about optimizing WAL sequential callbacks. It would be the first step to make the AutoMQ storage layer code more concise. If you are interested, I would greatly appreciate it if you would take it.

Next, we can continue to optimize the concurrency issues in S3Storage.

In the future, the WAL plan will be changed to a sequential success model to improve code maintainability while meeting current performance requirements.
This PR increases the consideration cost for concurrent scenarios, and it is not recommended to over-optimize in scenarios without performance issues.

Yeah, I agree with your point. But for this PR specifically, the performance improvement is indeed an added bonus. I think what's more significant is the improvement in code maintainability achieved by cohesively incorporating the persistence behavior into the object itself and decoupling the persistence operations from the ack response handling.

I have created an #1718 about optimizing WAL sequential callbacks. It would be the first step to make the AutoMQ storage layer code more concise. If you are interested, I would greatly appreciate it if you would take it.

Next, we can continue to optimize the concurrency issues in S3Storage.

That's great, I'd be happy to take it

@CLFutureX CLFutureX closed this Aug 15, 2024
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.

2 participants