Skip to content
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

[Backend] Cache - Update max_cache_staleness logic #3451

Closed
wants to merge 21 commits into from

Conversation

rui5i
Copy link
Contributor

@rui5i rui5i commented Apr 6, 2020

This PR updates max_cache_staleness logic to:

  1. get all_unexpired_cache_entry with target cache_key
  2. from all_unexpired_cache_entry get valid cache entry:
    (1) if cache_entry is too old for target pod, ignore
    (2) if pod.maxCacheStaleness != -1, return latest cache_entry with entry.maxCacheStaleness == pod.maxCacheStaleness
    (3) return overall latest cache_entry if pod.maxCacheStaleness == -1

Part of #2904

@kubeflow-bot
Copy link

This change is Reviewable

@k8s-ci-robot k8s-ci-robot added size/M and removed size/S labels Apr 6, 2020
@rui5i
Copy link
Contributor Author

rui5i commented Apr 6, 2020

/assign @Ark-kun

@rmgogogo
Copy link
Contributor

rmgogogo commented Apr 6, 2020

/lgtm

@rmgogogo
Copy link
Contributor

@Ark-kun will leave approval to you.
I'm OK with this PR.

@Ark-kun
Copy link
Contributor

Ark-kun commented Apr 23, 2020

Hmm. Initially I had the impression that the code logic in this PR was different from the stated logic. However, now I see that the logic was later revised and now it looks correct.

I'd like to add some tests to verify the logic before checking this PR in though.
/hold

@rmgogogo
Copy link
Contributor

rmgogogo commented May 6, 2020

Hmm. Initially I had the impression that the code logic in this PR was different from the stated logic. However, now I see that the logic was later revised and now it looks correct.

I'd like to add some tests to verify the logic before checking this PR in though.
/hold

kindly ping. Alexy, will you continue this PR? Assume it won't block 0.5.1 release.

@rmgogogo rmgogogo closed this May 6, 2020
@rmgogogo rmgogogo reopened this May 6, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign ark-kun
You can assign the PR to them by writing /assign @ark-kun in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rmgogogo
Copy link
Contributor

rmgogogo commented May 6, 2020

(sorry, miss clicked close)

@@ -76,7 +77,7 @@ func (s *ExecutionCacheStore) scanRows(rows *sql.Rows, podMaxCacheStaleness int6
}
log.Println("Get id: " + strconv.FormatInt(id, 10))
log.Println("Get template: " + executionTemplate)
if maxCacheStaleness == -1 || s.time.Now().UTC().Unix()-startedAtInSec <= podMaxCacheStaleness {
if maxCacheStaleness == -1 || s.time.Now().UTC().Unix()-startedAtInSec <= maxCacheStaleness {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the check needs to be

Suggested change
if maxCacheStaleness == -1 || s.time.Now().UTC().Unix()-startedAtInSec <= maxCacheStaleness {
if podMaxCacheStaleness == -1 || s.time.Now().UTC().Unix()-startedAtInSec <= podMaxCacheStaleness {

(with podMaxCacheStaleness parameter added back to the function).
The task cannot/should not control whether its data can be reused in the future. It can only control whether it can be skipped.
So, when we do lookup, we only care about the preferences of the current pod/task.

@stale
Copy link

stale bot commented Oct 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale The issue / pull request is stale, any activities remove this label. label Oct 7, 2020
@stale
Copy link

stale bot commented Oct 15, 2020

This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it.

@stale stale bot closed this Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold lgtm lifecycle/stale The issue / pull request is stale, any activities remove this label. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants