dotnet-operator-sdk icon indicating copy to clipboard operation
dotnet-operator-sdk copied to clipboard

Investigate the item cache

Open buehler opened this issue 3 years ago • 4 comments

Investigate the possibility to remove the item cache with "resourceVersion" and "generation"

buehler avatar Aug 19 '21 17:08 buehler

@stebenz I know what you meant by the resourceVersion / observed version and generation. (https://stackoverflow.com/questions/47100389/what-is-the-difference-between-a-resourceversion-and-a-generation/47101418)

Right now, the item cache is needed to determine if changes on the entities are only in the status part or in the spec part of a resource. I need to investigate further if there is any chance to detect such changes without caching all items. (However, caching the items does not use that much memory - at least at the time being)

buehler avatar Aug 20 '21 06:08 buehler

I would want to possibly benchmark the performance/reliability of the method, but how about storing the output of GetHashCode for both the object and the status sub-resource. I know at least with System.Text.Json, you can call that on its value-typed JsonElement and JsonDocument for consistent results... not sure about Newtonsoft.Json

erin-allison avatar Sep 09 '21 12:09 erin-allison

Hmm good call... Depending on the outcome of the discussion about created/updated, maybe the cache is not needed anymore. Or at least only with the items you just said.

buehler avatar Sep 09 '21 13:09 buehler

I think the cache would still be needed in some capacity as the SDK still would need some way to compare to determine Modified vs StatusModified

erin-allison avatar Sep 09 '21 13:09 erin-allison