-
Notifications
You must be signed in to change notification settings - Fork 807
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 Cache Implementation #35
Comments
/cc @bertinatto Let me know how do you think of the problem and my proposal |
Ah. Found out that this what the in-tree implements as well: https://github.com/kubernetes/kubernetes/blob/v1.12.2/pkg/cloudprovider/providers/aws/device_allocator.go#L42 |
Yes, I decoupled the device management code from k8s an created the package
This is also from in-tree. What kind of problem can we have with
I'm not sure if I'm following. The device release is deferred even when it has a taint. |
I thought the reason
|
The current cache implement has some issues that could be improved:
Deprioritize
each timeGetNext
is called. The only timeDeprioritize
is called is afterGetNext
, we can combine the two methods together to help on maintainability and understanbility and reduce the chance that someone forget to callDeprioritize
GetNext
is nondeterministic, this is caused by sort.Sort which uses quick sort that is unstable sort.Proposal:
Next()
each time attaching a volume. InsideNext()
call, looping through all the combinations of device names and returns the first one that is not in the cache set. This won't cause any performance issue, since the loop iteration count is very small (in the scale of number of device names, less than 100)Remove(deviceName)
each time detaching a volume. InsideRemove()
call, remove the device from the device name set.The text was updated successfully, but these errors were encountered: