Skip to content

has_message_available() for readers is slower from 3.5.0 onwards #257

@abeliangroupie

Description

@abeliangroupie

Hi, I've been trying to use the Python Pulsar client with a bare metal cluster and I've been finding that has_message_available() is much slower from 3.5.0 onwards.

For example, if I do something simple like this:

import time

import pulsar

client = pulsar.Client("pulsar://localhost:6650")

reader = client.create_reader(
    "persistent://foo/bar/my-topic",
    start_message_id=pulsar.MessageId.latest,
)

reader.seek(int(time.time() - 1*60*60) * 1000)  # Seek to 1h ago.

for _ in range(5):
    start_time = time.time()
    reader.has_message_available()
    print(time.time() - start_time)

For both pulsar-client==3.4.0 and pulsar-client==3.5.0 the first has_message_available() call takes about a second, but after that I'm finding that each call takes about 5e-6 seconds for v3.4.0 (pretty quick), but about 0.2 seconds for v3.5.0 (a lot slower).

There were some bug fixes regarding has_message_available() and seeking that were introduced in v3.5.0 -- it's possible that the slowdown I'm running into might be related to that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions