-
Notifications
You must be signed in to change notification settings - Fork 166
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
syncx(feat): 添加具有最大申请次数限制的Pool #233
Conversation
Signed-off-by: longyue0521 <longyueli0521@gmail.com>
Signed-off-by: longyue0521 <longyueli0521@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #233 +/- ##
==========================================
- Coverage 95.91% 95.90% -0.01%
==========================================
Files 60 61 +1
Lines 3233 3250 +17
==========================================
+ Hits 3101 3117 +16
- Misses 102 104 +2
+ Partials 30 29 -1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: longyue0521 <longyueli0521@gmail.com>
Signed-off-by: longyue0521 <longyueli0521@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个结构的使用场景我有点不太明白。因为从理论上来说,我为啥要限制这个使用次数?我需要的时候我就申请,我不需要就算了。
之前提到的“一个用户请求,需要申请1MB缓冲区完成业务,看起来合理、问题也不大. 但是一段时间内大量并发用户申请的缓冲区的总量可能占用大量内存,从而影响到同一机器内的其他业务“ 所以需要控制住Pool的最大总内存占用量, 因为Pool中的对象都是通过new方法获得的,可以认为每个对象占用内存大致相等,那么控制住一段时间内的申请次数就相当于间接控制住Pool的最大总内存占用量. |
通过控制一段时间内Pool的最大申请次数(可串行、可并行)来间接控制住Pool的最大使用量