HNHacker News
TopNewBestAskShowJobs

mfateev

240 karma · joined January 19, 2017

CEO/Co-founder of temporal.io
submissionscomments
mfateev··on Introduction to Simple Workflow Service (SWF)
Try temporal.io. It is just a Java library without any code generation and AspectJ. It also allows to write synchronous code while Flow was only asynchronous.
mfateev··on Introduction to Simple Workflow Service (SWF)
The change in approach is intentional. It is still possible to use the old method, but for the majority of cases, it is just too heavyweight. There are two main problems with versioning entire workflows:

1. Need to keep the workers with old code around. It might be solved for some languages like Java by dynamic code loading, but it is still pretty complex. For long-running workflows dozens of changes can happen during their lifetime, requiring dozens of versions to be present at runtime.

2. When a bug is fixed the old versions do not get the fix as they are inherently immutable. Thus a workflow that runs for a month and has started yesterday is still going to experience a bug that was fixed today.

The approach that Temporal promotes is to version each piece of code independently when needed. This way, there is only one version of the entire code in production to maintain, and bug fixes can be deployed any time and apply to all the open workflows that didn't reach the code that was fixed.

mfateev··on Introduction to Simple Workflow Service (SWF)
I agree in principle that there is not single tool for every possible situation.

At the same time I witnessed hundreds of cases when developers spent inappropriate amount of time developing "abstractions into application layer" instead of the business logic.

mfateev··on Introduction to Simple Workflow Service (SWF)
The Temporal/Cadence/SWF operate as libraries any application can include to be able to implement workflow and activity logic. So hooking into low-level VM event loop was not an option. So they rely purely on event sourcing to reexecute the program code from the beginning assuming that the workflow code is deterministic. The library provides various API wrappers to execute multithreaded code deterministically using cooperative multithreading. In the future, WebAssembly can be used as a container as determinism is one of its core features.
mfateev··on Introduction to Simple Workflow Service (SWF)
The article is pretty naive. It writes code against the low level API which was never intended for workflow writers and then complains that it is too complicated. He had to use the high level library (https://docs.aws.amazon.com/amazonswf/latest/awsrbflowguide/...) instead.

It is like writing assembler code against raw Linux kernel systems calls while Python is available and complaining that Linux is too hard to use.

Look at the temporal.io samples which give you completely different view of how such code should look like. For example the money transfer sample (taken from https://github.com/temporalio/java-samples/blob/master/src/m...):

```

  public class AccountTransferWorkflowImpl implements AccountTransferWorkflow {

     private final ActivityOptions options =
      ActivityOptions.newBuilder().setStartToCloseTimeout(Duration.ofSeconds(5)).build();
     private final Account account = Workflow.newActivityStub(Account.class, options);

     @Override
     public void transfer(
         String fromAccountId, String toAccountId, String referenceId, int amountCents) {
       account.withdraw(fromAccountId, referenceId, amountCents);
       account.deposit(toAccountId, referenceId, amountCents);
     }
  }
```
mfateev··on Introduction to Simple Workflow Service (SWF)
This mentality leads to systems that are a mess of callbacks, don't scale, and practically impossible to maintain.

You could make the same argument about SQL databases. Why do you need to understand their architecture, learn arcane SQL syntax, and learn to operate them? Instead, your program could write and read files directly from disk. But you still choose to use the DB as it has hundreds of man-years invested in it and gives you a higher level of abstraction.

Think about SWF and its newest incarnation in the form of temporal.io as a higher-level way to write task orchestrations. It requires some learning but allows you immediately to leverage dozens of man-years invested in the technology.

mfateev··on Introduction to Simple Workflow Service (SWF)
Look at temporal.io. I believe we managed to get rid of the original SWF rough edges while maintaining the "workflow as code" approach. And the best part is that it is open source and you can run it anywhere yourself.
mfateev··on Introduction to Simple Workflow Service (SWF)
I personally think that any such standard would be inferior to any general purpose programming language.

Independently of my opinion on the standard I think the best implementation platform for it would be temporal.io.

mfateev··on Introduction to Simple Workflow Service (SWF)
I'm original tech lead of SWF and later of the Cadence Workflow (cadenceworkflow.io) and Temporal Workflow (temporal.io) open source projects.

AMA.

mfateev··on Introduction to Apache Airflow
As a team lead of the Cadence/Temporal it is really amazing to hear such a feedback. Thank you!

BTW. You can AMA about the technology here.

mfateev··on Introduction to Apache Airflow
There is #ruby-sdk channel in the Temporal Slack: https://join.slack.com/t/temporalio/shared_invite/zt-c1e99p8...
mfateev··on Introduction to Apache Airflow
Temporal has an externally contributed Ruby client. It is going to be open sourced very soon.
mfateev··on Testing Distributed Systems with Deterministic Simulation (2014) [video]
WebAssembly allows deterministic execution (with caveats: https://github.com/WebAssembly/design/blob/master/Nondetermi...) of any code. I think it is a perfect platform for such type of testing.
mfateev··on Goodbye, Clean Code
Go error handling is a good example of this. So far all the attempts to reduce the repetitive `if err != nil { ... }` through some abstraction failed. Look at https://github.com/golang/go/issues/32825
mfateev··on Ask HN: What Technologies to Learn in 2020?
I mean systems that have to scale to hundred of millions of users and guarantee durability in presence of infrastructure and software failures.

Cadence is used in production by over 100 teams at Uber and multiple outside companies. For example here is a presentation that describes how HashiCorp relies on Cadence for the new version of its Consul product: https://www.hashicorp.com/resources/making-multi-environment.... The Cadence related part starts at 17:30.

mfateev··on Ask HN: What Technologies to Learn in 2020?
Learn Cadence Workflow (https://cadenceworkflow.io/). It implements a new way to build distributed systems using fault tolerant virtual memory. It lowers the complexity bar for hardcore backend programming by eliminating the need for managing the application state through databases and queues.
mfateev··on Cadence: Uber's Workflow Orchestration Engine
Yes, it is technically possible to use Cadence instead of Piper/Airflow. The reason the Piper/Airflow is used is mostly historical. It was around for quite a time and Cadence is a relatively new project.
mfateev··on Cadence: Uber's Workflow Orchestration Engine
DSL is DOMAIN specific language. But it is common mistake to call GENERIC workflow definition a DSL.

My opinion is that DOMAIN specific languages are awesome when they are used for a specific narrow domain. For example AWS CloudFormation template is a DSL for a cloud deployment. If This Then That, also known as IFTTT is another good example of a narrow workflow definition.

At the same time a generic turning complete language in JSON/YAML/XML always starts simple but ends up as a complete mess. See https://mikehadlow.blogspot.com/2012/05/configuration-comple.... Any programming language is much better for writing complex programs. The problem is that most existing workflow/orchestration systems force developers to use unnatural programming patterns and libraries to make the code fault tolerant. Cadence is an attempt (pioneered by my team at AWS Simple Workflow and later picked up by Azure Durable Functions) to implement workflows as natural programs without much boilerplate concepts and code.

Think, why nobody tries to write complex backend programs in JSON? The reason that programming languages have well defined ways to deal with complexity. JSON based languages are good for limited domains, but anything complex makes them unusable. I've seen it hundreds of times already when DSL is abused and developers hate it.

So most of the Cadence workflows are written directly as Go/Java code. But when DSL is appropriate it can be added trivially by interpreting it by the worker code.

>Again - the same question: wouldn't it have been better to have a uniform declarative JSON ?

Again, declarative JSON is declarative only in narrow domains. The generic workflow definition language in JSON works only for very simple scenarios and is harder to write and debug then Go/Java code.

mfateev··on Cadence: Uber's Workflow Orchestration Engine
We don't have a public design document. This presentation contains some details about the internal architecture: https://www.youtube.com/watch?v=5M5eiNBUf4Q
mfateev··on Cadence: Uber's Workflow Orchestration Engine
(1) It simplifies the programming model. There is no way to serialize a state of the call stack through a library in most programming languages. You mentioned that Cadence is similar to C# wait/async. The SWF Flow library is. But the Cadence workflow code is fully synchronous, not requiring callbacks unless needed by the business logic. Applying new events to the cached workfow is also more efficient for large states.

(2) It depends. Nothing prevents a workflow writer from checkpointing the state explicitly (by calling continue as new). Infinitely running workflows do it periodically. But having the events history is awesome for rollbacks. For example in Cadence it is possible to rollback a bad change and automatically rollback the state of all your workflows to the good state. In database world a change that corrupted the state is much harder to deal with.

(3) The experience shows that the determinism requirement while requires some learning is not that hard to deal with. But the superior programming model it allows is liked by users.

mfateev··on Cadence: Uber's Workflow Orchestration Engine
Cadence is above :).

It allows:

Integrate any DSL without modiying the core service. Internally at Uber there are at least half dozen DSLs running on top of it.

It allows to write code that hides all the complexity that leads to the mess of queue + db implementations. The beginning of this talk explains the idea: https://youtu.be/BJwFxqdSx4Y

The gist of it is that you write just your business logic without thinking about callbacks and storage.

I recommend looking at the Cadence samples to get the taste of it. Join the Cadence Slack channel if you have any specific questions: https://join.slack.com/t/uber-cadence/shared_invite/enQtNDcz...

mfateev··on Cadence: Uber's Workflow Orchestration Engine
If only SWF was extended to run deciders on AWS Lamda. Without this the main advantage of the Step Functions is hosting. I personally would rather see an integrated system where the Step Functions are a natural extension of SWF not a completely separate system.

This is the direction the Cadence is going. We are planning to add support for integrating custom DSLs easily, but maintaining the core code based libraries.

BTW: If anyone is interested on running the Step Functions DSL on top of Cadence contact the Cadence team. We could work together to get it implemented.

mfateev··on Cadence: Uber's Workflow Orchestration Engine
It is the latter. The workflow state object is chached including the goroutines the workflow code is blocked on. And the new events are applied to the cached object.
mfateev··on Cadence: Uber's Workflow Orchestration Engine
gRPC is not exposed to the Cadence users directly. They program against the client side library that completely hides the communication mechanism. And you are free to choose any object serialization mechanism. Currently JSON is the default wire encoding.
mfateev··on Cadence: Uber's Workflow Orchestration Engine
It could be solved by Celery, but it would also require a database and Celery doesn't scale that well unless runs on top of Redis which is not really fault tolerant. Also actions invocation with guarantees and exponential retries is not trivial with Celery.

Actually at Uber large number of services are being migrated from Python/Celery to Go/Cadence.

mfateev··on Cadence: Uber's Workflow Orchestration Engine
TChannel has very limited language support and is essentially deprecated. gRPC is supported by majority of mainstream languages and is under active development.
mfateev··on Cadence: Uber's Workflow Orchestration Engine
Look at the Cadence samples. You write code as a synchronous event handler, but it is interpreted as a workflow.

https://github.com/uber/cadence-java-samples

mfateev··on Cadence: Uber's Workflow Orchestration Engine
Cadence doesn't require workflow and activity type registrations which eliminates most of the problems with SWF versioning. Cadence supports versioning of the workflow code out of the box. Any change has to be protected with a version condition. It works even with shared libraries and very long running workflows.
mfateev··on Cadence: Uber's Workflow Orchestration Engine
Cadence is a service. The workflow and activity code lives outside of it. Think about Cadence workflow and activity code the same way you think about a queue consumer which is external to the queueing service.
mfateev··on Cadence: Uber's Workflow Orchestration Engine
Argo workflows are DAGs written in YAML. The types of workfows you can create using this syntax is very limited. Cadence gives you full power of a programming language like Java or Go to implement workflow logic. It is possible to implement support for argo DSL on top of Cadence. The reverse is not possible.

Cadence is also more scalable supporting tens of thousands events per second and hundreds of millions of open workflows.

← PreviousPage 3 of 4Next →