Difference between Cancel and Terminate

Terminate is like kill -9. It stops workflow without giving it any chance to execute any cleanup logic.

Cancellation allows the workflow to execute whatever cleanup logic necessary (even long-running) before completing it.

The cancellation mechanism depends on the SDK. In Go, it just invalidates context passed to a workflow function.

In Java, it cancels CancellationScope that wraps the main workflow function.