Skip to content
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

[Question] <title>Is it necessary to incorporate a local caching mechanism into the instance creation process? #2898

Open
doveLin0818 opened this issue Dec 24, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers question Further information is requested

Comments

@doveLin0818
Copy link
Contributor

Question

Recently, I fixed an issue related to instance reuse; for more details, please refer to #2886. To quickly address the online bug, my solution was somewhat crude. Below is the modified code, which prevents instance reuse problems caused by IP switching.
image

However, if a user or organization needs to monitor multiple Kafka instances, the current logic becomes ineffective, as it continuously creates new Kafka instances, potentially leading to performance degradation. Similarly, the existing code for RocketMQ repeatedly creates instances without enabling reuse. If an enterprise monitors multiple instances and requires high real-time performance with short monitoring refresh intervals, the repeated creation of instances becomes a significant concern.
image

Therefore, I am considering whether it is necessary to introduce a local caching mechanism (such as using Caffeine). The key could be a combination of app+ip+host, and the value would be the corresponding instance. Additionally, setting a relatively small cache size to prevent memory overflow and implementing an LRU eviction policy—which aligns well with our monitoring scenarios—would effectively allow the reuse of created instance objects, and we can start by implementing this for the Kafka client first and subsequently enable a gradual rollout.

If the community agrees that this solution is viable, please assign it to me, and I am willing to implement it.

@doveLin0818 doveLin0818 added the question Further information is requested label Dec 24, 2024
@tomsun28
Copy link
Contributor

+1 connection local caching mechanism is already use in ssh db and soon. suggest we use ConnectionCommonCache in kafka client like others.
@zhangshenghang how about this?

@zhangshenghang
Copy link
Member

+1 connection local caching mechanism is already use in ssh db 和 soon. suggest we use ConnectionCommonCache in kafka client like others. @zhangshenghang how about this?

This is a very good idea,@doveLin0818 Can you complete it? If you can, I will assign it to you.

@doveLin0818 You can refer to

private final ConnectionCommonCache<CacheIdentifier, SshConnect> connectionCommonCache;

@doveLin0818
Copy link
Contributor Author

+1 connection local caching mechanism is already use in ssh db 和 soon. suggest we use ConnectionCommonCache in kafka client like others. @zhangshenghang how about this?

This is a very good idea,@doveLin0818 Can you complete it? If you can, I will assign it to you.

@doveLin0818 You can refer to

private final ConnectionCommonCache<CacheIdentifier, SshConnect> connectionCommonCache;

@zhangshenghang hi,please assign to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
Development

No branches or pull requests

3 participants