How many Activities should I use in my Temporal Workflow?
Blog post from Temporal
Deciding how to structure Activities within Temporal Cloud involves balancing the trade-offs between using more or fewer Activities, each carrying implications for system performance, cost, and workflow manageability. More Activities can increase the complexity and resource usage of the Temporal service, while fewer Activities might complicate workflow design and limit the use of built-in tools like Retry and Timeout Policies. Best practices suggest fine-grained Activities for simplicity, maintainability, and observability, but there are scenarios where combining tasks into a single Activity makes sense, such as when utilizing specialized hardware, needing separate retry or timeout policies, or when dealing with financial costs of certain operations. Improved software quality and developer experience can be achieved by preferring more Activities, which enhance code clarity and enable easier debugging and maintenance. Ultimately, the decision to use more or fewer Activities should consider necessity, practicality, and preference, ensuring the workflow design meets specific use case requirements efficiently.