Is Conductor a right choice for 1M+ workflows per day?
The use case is messaging platform where message goes through different stages, some are simple and some are complex. Using workflow feels like a good fit to model it - some steps/tasks are async in nature and cannot be run synchronous.
Do you think Conductor can handle 1M+ workflows per day? Or 500 workflow initiations per second?
Thanks.
Hey @xaka, Conductor can handle 1M workflows. We're running similar ballpark workflows in production. There is still a concurrent decide issue, which we're trying to resolve by providing distributed locking interface, which can be best implemented with your own Zookeeper or similar locking system.
If you think you can patch bugs or improvements to solve your use case, and likewise for general community's use cases, you should be fine.
It also depends on the way you run your workflows. The implementation of SQS consumer is slow and just 1 consumer per host. For me, it can consume just 3-5 messages per second being the bottleneck for the number of concurrently executed workflows.
@kishorebanala Thank you for the updates. It will be great if you can share some information on the decider issues. Is it documented ? If no, what are the risks we are running against.
Also, what we have observed for high throughput workloads is as follows :
-
Make sure your first task is not a huge fork. It will increase the response times for create workflow. This is because it will recursively put all tasks in the queues.
-
You can consider making ES indexing async. Optionally, you can also provide a separate pool for the completable futures.
-
You can consider disablingSystemTaskWorkers in a "server" deployment and having a separate "executer" deployment with system task workers enabled for processing HTTP tasks. This will really help in avoiding periodic peaks in gc on the server.
-
Ensure that you set a timeout on HTTP tasks (not the task timeout) but a hard read and connect timeout. As you must have observed conductor timeouts have very limited guarantees.
-
Make sure you are not throttled on Redis. Also, use Redis not MySQL for high write throughput workloads. It is worth considering a clustered Redis so that you can scale horizontally.
-
Make sure you have some strategy to achieve your workflow runs. Redis will fill up really fast and you cannot have eviction policies because we don't set TTL. Again, you cannot rely on LRU based approach, simply because it might evict other keys like tasks.
-
Make sure your worker tasks are idempotent.
-
Ensure that you are either fine with multiple invocations or merge the PR on idempotent workflow creations.
-
Consider auto-scaling executors / workers based on queue depth and consumption rate to avoid huge pile-ups (based on use case and load pattern)
-
Consider tuning the various parameter like number of tasks polled, polling freq, number of threads based on your requirements. Look out "not polling, queue full" lines in log.
-
Consider making HTTP task sync by changing the concrete implementation, if your use case demands.
@xaka
@mudit3774 Thanks for some great suggestions. We'll consider adding some of these to best practices section in documentation.
For 4., Conductor timeouts are strictly enforced on simple tasks, and we'd still have to debug and verify this for system tasks, especially HTTP.
-
Consider writing a service/process to archive workflows after execution.
-
We're still waiting on PR creator to cleanup before merging.
@kishorebanala thanks for the updates.
For 4, My understanding might be incorrect, but it seems that the task timeouts are enforced using the sweeper. So, I can tune it for stricter guarantees by changing sweep frequency, the trade-off being running the sweeper frequently.
For 6: We have actually implemented the StatusUpdateLister to just archive the workflow on terminal states. We could potentially consider adding support for "archival-policy" for workflows like "on-completion", "no-archival" etc. We could delegate it to another system but wouldn't it make sense to provide it as a part of the offering and could be considered in the roadmap if it is usable across clients.
The strategy for archiving the workflows could be specific to use case, for eg: Immediately on completion, or x days after completion etc.
But, it definitely makes sense to provide a default implementation as a separate module, that archives immediately through WorkflowStatusListener. I've added this to wishlist. I'm closing this issue as we've digressed from the original question. Feel free to open new issues with any suggestions or requests for enhancements.
@mudit3774 hi For 3: Can you elaborate on the implementation plan for question 3 My understanding might be incorrect,it means that start workflow on server1,and poll task on server2 use same db?
It also depends on the way you run your workflows. The implementation of SQS consumer is slow and just 1 consumer per host. For me, it can consume just 3-5 messages per second being the bottleneck for the number of concurrently executed workflows.
Hey @mudit3774 were you ever able to get more than one consumer per host? We're having serious performance issues with starting workflows with events (in our case, AMQP). We're only getting throughput of 3-5/s for events like you, whereas sending a POST request maxes out at around 60-70/s. This is very disappointing; we expected event based workflow starts to be faster than HTTP.
Maybe we're missing some necessary configurations? We're on Conductor v3.5.3. Thanks.