Scale-out AsyncIOScheduler/AsyncIOExecutor to more than 1 CPU
See original GitHub issueIs your feature request related to a problem? Please describe.
We’ve been proud users of apscheduler for around four years now, and as my company is growing, so is our usage of apscheduler. Most of our jobs (95%) are IO-bound, and as our codebase is heavily asyncio-oriented we’ve been successfully using AsyncIOScheduler/AsyncIOExecutor.
4 years later the 5% of the jobs that still need CPU (the overhead around data manipulation mostly) are overflowing a single CPU core (of a Z1D AWS instance) and we need to make adjustments. Hence the question: is there a built-in or an easy way with apscheduler to share the load among multiple core (without hitting the GIL, obv)?
Describe the solution you’d like
Ideally we’d love to use a mix between AsyncIOExecutor
and ProcessPoolExecutor
, each job being dispatched to a process running its own event loop and reporting to the main process (holding the scheduler) once it’s done.
Describe alternatives you’ve considered
As a quick fix for our problem: We will probably have a list with the jobs we want to run, pre-fork a main process to split this list in N, and give 1/N-th of the list of jobs to each forked process, each having its own instance of apscheduler.
Feel free to redirect me to somewhere else, a previous issue, a doc, a discussion…
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
You’re welcome, apscheduler is a great-rock-solid project, we’re happy if we can somewhat contribute back to the community.
I needed, this is a stripped down version of the code we use:
We did, no particular roadblock to mention (it’s been running in production for the last two months). The main stuff we’ve identified and focused-on were: