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

perf: Optimize time-based filtering on large number of workflows #3340

Merged
merged 3 commits into from
Jul 1, 2020
Merged

perf: Optimize time-based filtering on large number of workflows #3340

merged 3 commits into from
Jul 1, 2020

Conversation

terrytangyuan
Copy link
Member

@terrytangyuan terrytangyuan commented Jun 29, 2020

This PR introduces a new WorkflowPredicate for filtering workflows based on a time range, which brings performance gains when listing large number of workflows, especially when the first filtering condition only filtered out very small number of workflows this could be a huge speed-up.

Signed-off-by: terrytangyuan [email protected]

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed the CLA.
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

@terrytangyuan terrytangyuan changed the title perf: Optimize argo list time-based filtering perf: Optimize time-based filtering on large number of workflows Jun 29, 2020
@@ -125,6 +125,11 @@ var (
return !wf.Status.FinishedAt.IsZero() && wf.Status.FinishedAt.Time.Before(t)
}
}
WorkflowHappenedBetween = func(startTime time.Time, endTime time.Time) WorkflowPredicate {
Copy link
Contributor

Choose a reason for hiding this comment

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

WorkflowRanBetween?

Copy link
Member Author

@terrytangyuan terrytangyuan Jun 29, 2020

Choose a reason for hiding this comment

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

Much better. Updated. Thanks!

Signed-off-by: terrytangyuan <[email protected]>
@@ -125,6 +125,11 @@ var (
return !wf.Status.FinishedAt.IsZero() && wf.Status.FinishedAt.Time.Before(t)
}
}
WorkflowRanBetween = func(startTime time.Time, endTime time.Time) WorkflowPredicate {
Copy link
Contributor

@alexec alexec Jul 1, 2020

Choose a reason for hiding this comment

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

interesting, I can think of other interpretation of this:

  • the workflow started between times A and B - e.g. WorkflowStartedBetween
  • the workflow finished between times A and. B - e.g. WorkflowFinishedBetween
  • the workflow was running between the two times - i.e. start time is before B and (not finished OR finished after time A) - e.g. WorkflowRanBetween?
  • the workflow was ran and finished between the two times - i.e. started after A and finished before B - e.g. WorkflowWasBetween?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Should we discuss further on a better design in a separate issue? The original purpose of this PR is to optimize the performance of the existing functionality. We can definitely break this down and see if we can come up something more comprehensive and useful in practice.

@alexec alexec merged commit 1db93c0 into argoproj:master Jul 1, 2020
@terrytangyuan terrytangyuan deleted the optimize-time-filtering branch July 1, 2020 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants