-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
improve the accuracy of memory occupation estimate of InMemoryDelayedDeliveryTracker. #23699
Comments
Do you have any idea on it? @lhotari @dao-jun @poorbarcode @codelipenghui @BewareMyPower |
@thetumbled We first need to understand the use case and problem to be solved. Please provide more context of what this measurement information is used for. This could help us understand why this would be important. For RoaringBitmaps, there's also a method I checked the RoaringBitmaps source code and it seems that there isn't currently an API to calculate the total size of allocated memory. What
Where is this recommended? This is a very heavy weight solution. I wouldn't recommend it at all for this use case. |
When using delayed message queue feature, broker face with the risk of OOM as client may set enormous number of entries to be delayed due to incorrect usage or logical bug. We need to monitor the memory occupation of each user task to distinguish the bad task.
IMO, there is no need to use
The comment of method recommend it:
The stars of this repo is few and it is not the best solution seemingly, so i search for help from the community to find out the best one. |
Search before asking
Motivation
Now, the memory usage of InMemoryDelayedDeliveryTracker is based on
org.roaringbitmap.longlong.Roaring64Bitmap#getLongSizeInBytes
, referenced inorg.apache.pulsar.broker.delayed.InMemoryDelayedDeliveryTracker#getBufferMemoryUsage
.According to the comment of the method,
We can see that, the essitimate value is within 1% of the true memory usage in common usage scenarios, while in adversarial cases, this estimate may be 10x the actual memory usage, which range wide.
As delayed message queue consume a lot memory, we need to measure it more accurate.
Solution
According to the comment of method, a lib called
ehcache-sizeofengine
is recommended.https://github.com/ehcache/sizeof
I wonder whether it is the best solution, is there any lib better than it?
Alternatives
No response
Anything else?
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: