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

Consider: "pre-task sleeping" #2

Open
Vectorial1024 opened this issue Dec 5, 2024 · 1 comment
Open

Consider: "pre-task sleeping" #2

Vectorial1024 opened this issue Dec 5, 2024 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@Vectorial1024
Copy link
Owner

Not sure if this would be useful, but the idea is that, perhaps we may want to start many tasks at the same time, but starting this many tasks at the same time would cause system instability, so individual tasks are required to sleep a bit before they start working, to ease out the workload spike.

This might interact with #1.

@Vectorial1024 Vectorial1024 added enhancement New feature or request question Further information is requested labels Dec 5, 2024
@Vectorial1024
Copy link
Owner Author

The main goal is to prevent performance spikes and dips to ensure system stability. This will become important when we may want to start many async tasks at the same time.

One way to do it is to start many tasks but let them separately sleep randomly at the start of the task. This prevents CPU spikes, but will eat up process IDs. This cannot be good when we may suddenly have many "sleeping" processes, and it will mess with the PHP execution time limit.

The other way to do it is to let the task giver sleep a bit before actually starting the task, and tasks do not need extra sleep when they are run. This delays the task giver, but can prevent the "many sleeper" situation from happening.

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

No branches or pull requests

1 participant