You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/06 14:03:01 UTC
[GitHub] [pulsar] AnonHxy opened a new issue, #16422: PIP-181: Reduce unnecessary REST call between brokers
AnonHxy opened a new issue, #16422:
URL: https://github.com/apache/pulsar/issues/16422
## Motivation
The design of admin API now is such that: when handle a partitioned topic request, the broker will query the topic's partition meta, and then use the internal admin client to query all the non-partitioned topics (I.e. the suffix of the topic name is `-partition-`),
even if the non-partitioned topic is owned by the broker, which will cause unnecessary REST call between brokers.
we can call the methods directlly, who handle the non-partitioned topic, to reduce the unnecessary REST call.
## Goal
* Try to call the methods directlly if the non-partitioned topic is owned by the broker
## Implementation
* We need to check all the place where `org.apache.pulsar.broker.PulsarService#getAdminClient` is invoked in `org.apache.pulsar.broker.admin.impl.PersistentTopicsBase`
* take `internalGetPartitionedStats` for example:
* Original:
```
for (int i = 0; i < partitionMetadata.partitions; i++) {
try {
topicStatsFutureList
.add(pulsar().getAdminClient().topics().getStatsAsync(
(topicName.getPartition(i).toString()), getPreciseBacklog, subscriptionBacklogSize,
getEarliestTimeInBacklog));
} catch (PulsarServerException e) {
asyncResponse.resume(new RestException(e));
return;
}
}
```
* Suggest to do like this:
```
for (int i = 0; i < partitionMetadata.partitions; i++) {
TopicName topicNamePartition = topicName.getPartition(i);
topicStatsFutureList.add(
pulsar().getNamespaceService().isServiceUnitOwnedAsync(topicName)
.thenCompose(owned -> {
if (owned) {
// local call
return getTopicReferenceAsync(topicNamePartition)
.thenCompose(topic ->
topic.asyncGetStats(getPreciseBacklog, subscriptionBacklogSize,
getEarliestTimeInBacklog));
} else {
// call from admin client
try {
pulsar().getAdminClient().topics().getStatsAsync(topicNamePartition.toString()),
getPreciseBacklog, subscriptionBacklogSize, getEarliestTimeInBacklog)
} catch (PulsarServerException e) {
throw new RestException(e);
}
}
})
);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] github-actions[bot] commented on issue #16422: PIP-183: Reduce unnecessary REST call in broker
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #16422:
URL: https://github.com/apache/pulsar/issues/16422#issuecomment-1207316122
The issue had no activity for 30 days, mark with Stale label.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on issue #16422: PIP-183: Reduce unnecessary REST call in broker
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on issue #16422:
URL: https://github.com/apache/pulsar/issues/16422#issuecomment-1176975208
Thanks @Jason918 @HQebupt
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Jason918 commented on issue #16422: PIP-183: Reduce unnecessary REST call in broker
Posted by GitBox <gi...@apache.org>.
Jason918 commented on issue #16422:
URL: https://github.com/apache/pulsar/issues/16422#issuecomment-1176967207
@AnonHxy changed to 183
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] HQebupt commented on issue #16422: PIP-181: Reduce unnecessary REST call in broker
Posted by GitBox <gi...@apache.org>.
HQebupt commented on issue #16422:
URL: https://github.com/apache/pulsar/issues/16422#issuecomment-1176958097
@AnonHxy We have a conflict in the PIP number here. Could you please change the number ?
https://github.com/apache/pulsar/issues/16274
https://github.com/apache/pulsar/issues/16250
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org