Temporal
What is Temporal
Runtime for managing distributed application state at scale.
Scalable and reliable runtime
for durable function executions.
Function Executions
in UI = TemporalWorkflow Executions
.
Guarantees durable execution of application code.
- Durable execution means an ability of a Workflow Execution to maintain its state and progress even in the face of failures, crashes, or server outages.
Why use queue (Temporal) over messaging (Kafka)
If you have critical operation that is expensive when failing (reliability problem), you need to use a queue.
Anatomy
Two main parts to Temporal:
Workflows
andActivities
.
Workflows default UI address in local environment:
http://localhost:8233/namespaces/default/workflows
Workflow
Worker holds and executes the Workflow.
Workflow is a stateful function to orchestrate the application.
- All variable and threads in a workflow are stored in the Temporal service.
When a server fails, the Temporal will continue exactly at the line of failure before the server crash.
You don't need queues or databases to track temporary state of the application.
Any number of workflows can process the activities.
Activity Functions (Activities)
Encapsulates code that interacts with an unreliable external services.
You don't need to write retry logics when an external call or system fails.
Activities do not have states, but it has native retry logic and automatic timeouts.
Hierarchy
Platform > Cluster > Worker > Workflows > Activities > Gateways
Platform
What is it
Consists of a Temporal Cluster
and Worker Processes
.
- Together these components create a runtime for Workflow Executions.
Temporal Cluster = supervising software Worker Processes = application code
Temporal Platform |-----------------------------------------------------| | | | |Workerprocess 1| Workerprocess 2| Workerprocess 3| | | | ||---------------------------------------------------|| ||Temporal Cluster || ||---------------------------------------------------|| | | |-----------------------------------------------------|
Each worker has its own configuration set.
- When there are conflicting config values across the workers, the most recent worker is respected.