-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
type/bugThe PR fixed a bug or issue reported a bugThe PR fixed a bug or issue reported a bug
Description
Search before reporting
- I searched in the issues and found nothing similar.
Read release policy
- I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
User environment
4.0.5
Issue Description
See #24458 (review)
Error messages
N/A
Reproducing the issue
Run the standalone.
Run the following application a few times:
final var admin = PulsarAdmin.builder().serviceHttpUrl("http://localhost:8080").build();
final var random = new Random();
for (int i = 0; i < 100000; i++) {
final var topic = "new-test-" + random.nextInt(10000000);
admin.topics().createNonPartitionedTopic(topic);
admin.topics().delete(topic);
}Even though there is no traffic, the TopicName's cache kept growing.
There were only 3 active topics but 20.3k TopicName cache entries.
Additional information
It's caused by the design of #23052, which has no limits to the TopicName's cache. It relies on the scheduled task to clear the whole cache if the size has reached 200000, the task is scheduled every 2 hours.
P.S. The proxy side didn't schedule the task before, so it caused an OOM here #24445
From the benchmark shown here, the performance of the cache will be downgraded if there are many keys.
Are you willing to submit a PR?
- I'm willing to submit a PR!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type/bugThe PR fixed a bug or issue reported a bugThe PR fixed a bug or issue reported a bug