Skip to content

Caching just Updated Custom Resource Optimization alternatives #588

@csviri

Description

@csviri

In case we execute a controller and update the custom resource at the end, it can take time while we receive the custom resource event from the server and gets into the informers cache in CustomResoureEventSource . This causes problem in case when there are already events received during the execution. In next reconciliation , what happens instantly, we use an old custom resource, and the next update will fail on conflict.

We handled this situation in V1 but simply caching manually the updated custom resource from the response of the update api call. Currently we cannot do this with informers (well not with a very hacky way)

Note that if there is retry in place this is not a correctness issue just an optimization, but this is possibly happening quite often, and it's quite ugly. Since we see lots of retries.

Alternative solutions to V2:

  1. Don't execute the buffered events instantly, just schedule a new one time event in the close feature (~1-2 second?), usually we receive the update custom resource until that time into cache (not necessary to the Event Handler because of generation filtering). We have to be careful there this event producing should be cancelled in case the event arrives. (I prefer this)
    (This would be also reusable to optimize the re scheduling of events)

  2. Don't filter out the next event from custom resource event source. This will allow to receive the event about the update and execute the custom resource. Note that is hard to make correct (if not impossible now) in all cases, there are possible timing issues we have to investiage)

  3. the combination of 1. and 2.

Metadata

Metadata

Assignees

Labels

caching-epickind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions