-
Notifications
You must be signed in to change notification settings - Fork 368
Improve the AckIDList performance when there are many topics subscribed #1305
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
Improve the AckIDList performance when there are many topics subscribed #1305
Conversation
fbed4d3 to
33f7146
Compare
|
I missed PR #1301 and I wonder does this |
Not an alternative. The Go API still returns an |
So that if I don't need to check each message exception, I can just regard AckError as a normal exception? I think using |
Yes. You can still write the following code: if err := consumer.AckIDList(msgIDs); err != nil {
fmt.Errorf("Failed to ack messages: %v", err)
}The design in Go client is more like to add the following exception to the Java client and document that this exception could be thrown by public static class AckException extends PulsarClientException {
private final Map<MessageId, PulsarClientException> exceptionMap;
public AckException(Map<MessageId, PulsarClientException> exceptionMap) {
super(toString(exceptionMap));
this.exceptionMap = exceptionMap;
}
private static String toString(Map<MessageId, PulsarClientException> exceptionMap) {
return ""; // TODO
}
} |
I got it, thank you very much. |
Motivation
Currently when a consumer subscribes multiple topic-partitions and
AckWithResponseis true, theAckIDListmethod will iterate over all internal consumers sequentially. It harms the performance especially there are many internal consumers. For example, if the connection of an internal consumer was stuck by some reason, message IDs from other consumer would be blocked for the operation timeout.Modifications
In
ackIDListFromMultiTopics, callconsumer.AckIDListin goroutines and use a channel to receive all errors from these calls.Add
TestMultiTopicAckIDListTimeout, which sets a dummy connection instance whoseSendRequestnever completes the callback, to verify theAckIDListcall will not take much more time than the operation timeout to complete. Without this improvement, it will take more than 5 times of the operation timeout to fail.