-
Notifications
You must be signed in to change notification settings - Fork 6
Remove bounds on shadow queue size #209
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
Conversation
2023c82
to
12b2979
Compare
Unit Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 24a9987 |
Integration Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 24a9987 |
src/main/java/com/aws/greengrass/shadowmanager/sync/strategy/BaseSyncStrategy.java
Outdated
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/shadowmanager/sync/RequestUnboundedQueue.java
Outdated
Show resolved
Hide resolved
/** | ||
* Default maximum number of queued requests. | ||
*/ | ||
static final int MAX_CAPACITY = 1024; |
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.
I understand that we will never reach this situation, but how are we handling the case where java throws an out of memory error when shadow manager tries to put a new request to the requests map?
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.
Never say never. You're right in the fact that we could hit this case. I'll take a look at the code tomorrow and try to add in a try-catch (or multiple) to account for this. The most sensible place I can see is on the put
call as the map should resize when inserting an element causes it to go above load factor.
f66aa03
to
cee2954
Compare
By removing bounds on the shadow queue size users can now have more than 1024 shadows. 'Take' operation behaviors remain the same however 'Put' operations will no longer block as waiting for space is not a thing.
129ca04
to
631d0f7
Compare
Closing in favor of #210. |
By removing bounds on the shadow queue size users can now have more than 1024 shadows. 'Take' operation behaviors remain the same however 'Put' operations will no longer block as waiting for space is not a thing.
Description of changes:
Removes the default shadow queue size limit
of 1024 shadows.
Misc changes:
Why is this change necessary:
By removing bounds on the shadow queue size
users can now have more than 1024 shadows. 'Take'
operation behaviors remain the same however 'Put'
operations will no longer block as waiting for
space is not a thing.
How was this change tested:
Figuring this out now
Any additional information or context required to review the change:
The Shadow-Manager has a queue for device shadows. This queue is limited to 1024 shadows by default (but dynamically sized when <1024). This hard limit will prevent customers from having > 1024 shadows. By removing this limit we allow more shadows with likely minimal to no effect for most customers.
For customers with > 1024 shadows this will fix blocking issues which will prevent the device from updating at the cost of additional memory.
Issue #, if available:
V1876603400
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.