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

engine/schedulemanager: isolate processing of individual schedules #1741

Closed
mastercactapus opened this issue Jul 12, 2021 · 7 comments
Closed
Labels
enhancement New feature or request stale This is inactive

Comments

@mastercactapus
Copy link
Member

What problem would you like to solve? Please describe:
All schedules are updated in a single transaction:

  • A single bug/problem causes all schedules to "freeze"
  • All schedules, regardless of number, need to finish within the time limit

Describe the solution you'd like:
Process one schedule at a time, up to some limit per cycle

Describe alternatives you've considered:
Continued risk.

Additional context:
Things to watch out for in implementation:

  • Ensure all schedules eventually get processed when multiple cycles are required
  • Performance impact & timing
@mastercactapus mastercactapus added the enhancement New feature or request label Jul 12, 2021
@mastercactapus
Copy link
Member Author

Possible approach:

  • Each cycle, fetch the list of all schedule IDs
  • Store last processed time per schedule in memory truncated to, say, a minute
  • shuffle the list of IDs, sorting oldest first
  • have update function fetch all data for a single schedule
  • Since we're fetching a single schedule, some queries may be combined
  • Potentially use batch queries from pgx
  • Move a schedule to the back of the list, pass-or-fail
  • Log errors but keep processing other schedules
  • Maybe set a fixed time allotment (e.g., process as many as possible within 2s) rather than a fixed number

@pavan541cs
Copy link

@mastercactapus Can I pick up this issue and work on this

@mastercactapus
Copy link
Member Author

I'd say this one is still in the planning phase. I did a bit of testing on this and a big issue with the approach I outlined is just to walk through the schedules by locking alone (no actually fetching/updating) results in a > 10x slowdown.

@stale
Copy link

stale bot commented Jan 26, 2022

This issue has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the stale This is inactive label Jan 26, 2022
@mastercactapus
Copy link
Member Author

Let's revisit this after the engine state is implemented (going in with metrics code).

@stale stale bot removed the stale This is inactive label Feb 15, 2022
@stale
Copy link

stale bot commented Sep 20, 2022

This issue has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the stale This is inactive label Sep 20, 2022
@mastercactapus
Copy link
Member Author

Obsoleted by #4245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale This is inactive
Projects
None yet
Development

No branches or pull requests

2 participants