-
Notifications
You must be signed in to change notification settings - Fork 18
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
resolvers: run in separate processes #538
Comments
#548 may reduce the urgency on this by optimizing some resolver stuff. |
Yeah, reason I didn't go with separate processes is so the resolvers have access to the central data-store (if it works that way) |
We could potentially put the data store into shared memory but I'm guessing that managing parallel access would be challenging. |
Silly idea, and wider scope..
The Would we even consider building a data-store for each subscription? advantages being:
Disadvantages would include machine load, amongst others.. First part, yes (and I think we've discussed it).. Second part, maybe? |
That sounds like a good idea. I think this aligns with what I was thinking of in #464. I think resolving subscriptions off of the same data store makes still sense so long as filtering by the n-window doesn't become prohibitively expensive. |
Yes we originally wanted n=0 (or perhaps 1) at the scheduler, since that's all it needs to schedule. |
(the only reason we would want n=1 at the scheduler is Tui, we can drop back to n=0 if there isn't a client connected) |
See also #194 |
In multi-user setups we may have multiple users subscribing to multiple workflows simultaneously.
Large workflows can cause heavy server load in some cases (e.g. #547). Because we handle each request synchronously on the same process, this means larger updates can hold up other updates. In the extreme, this can cause UIs to show as disconnected as a result of websocket heartbeat timeout.
Ideally we would find a way to run the resolvers for each workflow in separate processes to isolate them from each other. Though we would probably want to limit the number of processes and distribute subscriptions across a pool.
Original Post
We run subscriptions in a ThreadPoolExecutor.
In Python only one thread can actively run at a time (because of the GIL) so there is no compute parallelism advantage to this (but there may be IO concurrency advantages depending on the implementation details of the code being run).
This means that one large workflow can hog 100% of the CPU of the server, causing issues with other workflows.
We should be able to swap the ThreadPoolExecutor for a ProcessPoolExecutor. I had a quick try, but it didn't work first time, the first update came through but subsequent ones got stuck, so a little work required.
This does raise the question of how many processes the UI Server should be allowed to spawn. I think we should be able to run more subscribers than processes in the pool, but would need to read the docs to find out.
The text was updated successfully, but these errors were encountered: