-
|
Hello! When you enable concurrency, say And if it is the latter, does true parallelism require running multiple versions of the worker itself? For example, running Thanks! PS: Love the library and our team has been experimenting with it to build a better mental model of how it works. Would you be open to a pull request from us for some improvements on documentation? Think it might make things a little easier for users like us that are new to this library and task queues! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 14 replies
-
|
I think you got it right. Even with an event loop, I/O is still happening in parallel, so if your tasks are I/O-bound, they're parallel. If your tasks are CPU-bound, the mechanisms within Procrastinate aren't going to be very helpful but, as you said, launching multiple processes will get you to use all the CPU. The reason behind this choice is that multiprocessing is hard, and is often the place where a program crosses boundaries that make it more complex to deploy and scale. I felt the mental model of procrastinate was much simpler keeping it as a (mostly) single-threaded, single-processed program. Note that those points are mentioned here, and here but if it was still confusing to you, then by all means, feel free to do a PR, and I'll do my best to review & merge it. We're conceptually in the same situation as uvicorn, which lets you deploy a Python program that runs in an event loop. They have multiple modes of deployment:
I think the idea is that (especially if you're managing an event loop already), it makes sense not to also manage child processes. People are going to be using a process manager of their choice, and trying to do anything from the lib itself will only get in their way and bring unwanted complexity. |
Beta Was this translation helpful? Give feedback.
I think you got it right.
Even with an event loop, I/O is still happening in parallel, so if your tasks are I/O-bound, they're parallel. If your tasks are CPU-bound, the mechanisms within Procrastinate aren't going to be very helpful but, as you said, launching multiple processes will get you to use all the CPU.
The reason behind this choice is that multiprocessing is hard, and is often the place where a program crosses boundaries that make it more complex to deploy and scale. I felt the mental model of procrastinate was much simpler keeping it as a (mostly) single-threaded, single-processed program.
Note that those points are mentioned here, and here but if it was still confusing to you,…