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 2021/03/10 18:26:41 UTC
[GitHub] [pulsar] DonHaul opened a new issue #9873: admin getMessageById vs api seek+readnext Performance difference
DonHaul opened a new issue #9873:
URL: https://github.com/apache/pulsar/issues/9873
Performance of Regular org.apache.pulsar.client.api, is about 5x slower then admin org.apache.pulsar.client.admin to fetch single messages that were already consumend.
I am implementing a reader that needs to fetch 1 document at a time from bookeeper in a non sequential way.
Using a regular Reader to fetch a single document it takes around 119ms to fetch one message, while using the admin api it takes around 20ms is there any reason for this disparity?
I fetched 1000 messages using both methods to get those average times:
Reader API:
```
PulsarClient client = PulsarClient.builder()
.serviceUrl("pulsar://localhost:6650")
.build();
Reader reader = client.newReader()
.topic("persistent://apache/pulsar/baby-yoda").startMessageId(MessageId.earliest)
.startMessageIdInclusive()
.receiverQueueSize(1) //only fetches a single document
.create();
MessageId messageId= //somemessageid
int counter=0;
while (counter<1000) {
reader.seek(messageId);
Message document = reader.readNext();
counter++;
}
```
Admin API
```
PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl("http://localhost:8080").build();
Message m = null;
byte[] msg;
while (counter<1000) {
//topic ledger entry
try {
msg = admin.topics().getMessageById("testtopic3",4,982).getData();
} catch (PulsarAdminException e) {
e.printStackTrace();
}
counter++;
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on issue #9873: admin getMessageById vs api seek+readnext Performance difference
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #9873:
URL: https://github.com/apache/pulsar/issues/9873#issuecomment-796281680
The read API need to create an internal consumer to subscribe to the topic and send flow permits to the broker, then the broker read data from bookkeeper or tailing cache(batch read), but the admin API is reading the data from bookkeeper or tailing cache directly, and only read one message.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] DonHaul closed issue #9873: admin getMessageById vs api seek+readnext Performance difference
Posted by GitBox <gi...@apache.org>.
DonHaul closed issue #9873:
URL: https://github.com/apache/pulsar/issues/9873
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] DonHaul commented on issue #9873: admin getMessageById vs api seek+readnext Performance difference
Posted by GitBox <gi...@apache.org>.
DonHaul commented on issue #9873:
URL: https://github.com/apache/pulsar/issues/9873#issuecomment-796651649
That still happens when reader API is already created, and only needs to call `reader.seek();` and `reader.readNext();` ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on issue #9873: admin getMessageById vs api seek+readnext Performance difference
Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #9873:
URL: https://github.com/apache/pulsar/issues/9873#issuecomment-796653988
Just out of curiosity, why do you use Pulsar for this usecase? Pulsar is for pub/sub and queueing.
If you want to leverage your BK cluster to store objects and access them more efficiently you could take a look to
https://github.com/diennea/blobit
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] DonHaul commented on issue #9873: admin getMessageById vs api seek+readnext Performance difference
Posted by GitBox <gi...@apache.org>.
DonHaul commented on issue #9873:
URL: https://github.com/apache/pulsar/issues/9873#issuecomment-797371709
We are using it, not for the pub/sub but for it realtime capabilities and these persistent storage features (which are actually from bookkeeper). We also use it for reliability as if any messages failed to be consumed, they are still stored and can be consumed later.
Our program stores xml documents on bookkeeper and the consumer is responsible for creating references to it in an external db for with some of the fields on the xml. So say it stores field <name></name> (and some other fields) as well as a reference to the MessageID so that it can fetch the whole document if necessary.
Is blobit designed for realtime and reliability features? @eolivelli
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on issue #9873: admin getMessageById vs api seek+readnext Performance difference
Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #9873:
URL: https://github.com/apache/pulsar/issues/9873#issuecomment-797429516
@DonHaul
> Is blobit designed for realtime and reliability features?
yes it is, most notably it was initially designed to read the objects as soon as it has been written by the writer (it is using some feature in BK that is not used in Pulsar, like `readUnconfirmed`, in order to reduce latency.
feel free to open a ticket with your use case on the issue tracker on github.
cc @nicoloboschi @diegosalvi @dianacle
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org