转自:https://blog.bernd-ruecker.com/what-are-long-running-processes-b3ee769f0a27

Some communities have big reservations when using terms like workflow(overloaded), Business Process Management or BPM (automatically considered to be a BPM monolith, see The 7 sins of workflow) or orchestration (reminds people of old SOA days, smart pipes or central engines). So I started using the term long running process, but now people are asking me: “Is this a long running process?” In this article I list typical use cases and clarify terminology.

Hint: My goal is not to give a scientific definition. I just want to write down my current thoughts as an anchor for potential discussions, so I’m looking forward to get your feedback!

Sprint or Marathon? About short, long and very long running processes.

Must a long running process be a business process spanning days, weeks, months or even years? Or can it solely be an automated processes typically finished within milliseconds, but potentially waiting for system availability for a few seconds, minutes or sometimes hours?

Well, both! But doesn’t this pose different requirements on the solution? Only to a minor extent. Let’s dive into more details.

Use Cases

Edit: I published 5 Workflow Automation Use Cases You Might Not Have Considered on TheNewStack in the meanwhile, which gives an improved overview on use cases.

Straight through processing (STP) refers to processes that are fully automated. There are no human steps involved (in the best case). You might also call this service orchestration (German insurance companies even have another nice word for this: “Dunkelverarbeitung” —translated with “processing in the dark”).

Why do I consider these processes to be long running? Well, STP normally involves some kind of service invocation. As soon as we invoke services, there is the risk of waiting, either because we use an asynchronous channel (e.g. messaging) or we run into a service outage and have to incorporate some retry mechanism. Waiting immediately means long running, I’ll come back to the question of “how long?” in a minute.

Human task management means to push tasks on a todo list of some user. I never know when he is going to pick it up, so we have to wait and voila: long running. For the sake of simplicity I consider case management to be part of this category in this post.

The term workflow is typically used for a STP and human task management. Very often these use cases are mixed anyway. The most common example is that you might involve the human whenever STP hits an undefined problem, hence: long running.

Sagas are a quite old but a relatively unknown concept (except in the Domain Driven Design community). Sagas solve the problem that technical two-phase commit does not scale. Therefor

“a saga is a long lived transaction that can be broken up into a collection of sub-transactions that can be interleaved. All transactions in the sequence complete successfully or compensating transactions are ran to amend a partial execution.”

Quoted from Caitie McCaffrey. Long lived = long running.

Long running basically means waiting!

Edit: I added this section as I get this question very often.

Long running doesn’t mean there is real action all the time. Typically long running means that the process is waiting most of the time. This is not done by blocking any threads but typically by persisting state to some storage mechanism. So the term “long lived” might be even easier to understand for some readers.

So don’t get confused: long running basically means waiting most of the time.

Requirements

For all use cases you have to solve the same basic problems:

State handling & persistence: Whenever you have to wait, you need some kind of state handling. Typically you do not want to lose this state during a system hiccup — so you make it persistent. This might not be true for some systems only handling short-lived sagas within milliseconds where you trade performance for consistency. But most often, the duration of waiting doesn’t make a big difference; as soon as you wait, you persist.

When persisting state, you have to handle situations when the process does not progress or recover, so you have to handle timeouts & escalations. This is also true for STP when a bug in a third party system causes a missing response message. And as soon as you have processes waiting, you typically want to see what is going on, so you need some monitoring.

Versioning: Whenever you store state, you might run into situations where you develop a new version of your process and put it live, but still have instances of the old model running. Of course this is a much more pressing issue with very long running processes, but you normally also have to tackle it with shorter long running processes.

If you handle processes spanning huge time frames, things start to change. Think of life insurance; the process from applying for the contract till the payment (when you are dead) might (hopefully) span decades. Within this time frame you will definitely experience some major paradigm shifts in the IT industry (e.g. Mainframe to 3-tier-architectures to serverless, nosql and cloud). So I typically recommend to save state in long periods of inactivity as simple as possible. This will make it easier to transition to these new paradigms. Independent of the concrete product used, the simpler the state can be extracted, the simpler the migration will be.

By the way: I am still searching for a name for these very long processes. For now I have put them into a category called “entity life-cycle related business processes” —I don’t like this for several reasons so if you have a good idea, please let me know!

These very long running processes typically have a high level of activity only within shorter periods. So we can perfectly slice the overall process into pieces of activity (long running processes) and waiting (simple state). Typically the phases of activity do not extend 6 months.

But up to this time frame, the requirements are identical for all durations, ranging from milliseconds to months. That also means, that you can apply the same solution for a big variety of problems.

Implementing long running processes

There are various solutions to tackle long running processes. I want to dedicate a later blog post on these, including forces and consequences. As a teaser I highlight three options:

  • Save state within your own domain entities.
  • Do not save any central state but add information about it to all messages passed around (pattern: routing slip).
  • Use an engine (pattern: process manager), which might be a workflow engine, a process engine, a case engine, an orchestration engine or even a homegrown custom engine.

Having co-founded an Open Source BPM vendor, I only want to note in this post that a proper engine works for all use cases explained above :-)

Summary

A long running process can span from a few milliseconds up to decades. So duration is less important than the fact that you potentially have to wait, which is the case in almost any situation when humans or remote communication is involved.

Let me know what you think!

 
 
 
 

What are long running processes?的更多相关文章

  1. Show All Running Processes in Linux

    ps由于历史的原因,所以很奇特,有些命令必须加"-",比如: ps A 上面的写法是错误的 ********* simple selection ********* ******* ...

  2. check running processes in Ubuntu

    Check processes If you want to see what processes are running use the command ps -ef If you want to ...

  3. How to implement long running flows, sagas, business processes or similar

    转自:https://blog.bernd-ruecker.com/how-to-implement-long-running-flows-sagas-business-processes-or-si ...

  4. Working with Python subprocess - Shells, Processes, Streams, Pipes, Redirects

    Posted: 2009-04-28 15:20 Tags: Python Note Much of the "What Happens When you Execute a Command ...

  5. 创建hbase-indexer出现 0 running

    新建hbase-indexer后通过hbase-indexer list-indexers发现SEP subscription ID: null并且0 running processes,如下: IN ...

  6. Show tree of processes in linux

    pstree(1): tree of processes - Linux man pagehttps://linux.die.net/man/1/pstree How to view process ...

  7. linux processes

    So that Linux can manage the processes in the system, each process is represented by a task_struct   ...

  8. Inno Setup Pascal Script to search for running process

    I am currently trying to do a validation at the uninstall moment. In a Pascal script function, in In ...

  9. Uniform synchronization between multiple kernels running on single computer systems

    The present invention allocates resources in a multi-operating system computing system, thereby avoi ...

随机推荐

  1. ON 子句和 WHERE 子句的不同

    原文: https://www.cnblogs.com/zjfjava/p/6041445.html 即使你认为自己已对 MySQL 的 LEFT JOIN 理解深刻,但我敢打赌,这篇文章肯定能让你学 ...

  2. 2.11 C++转型构造函数

    参考:http://www.weixueyuan.net/view/6343.html 总结: 带参数的构造函数中有两种比较常见的构造函数:拷贝构造函数和转型构造函数. 转型构造函数只有一个参数,如果 ...

  3. countdownlatch 和 CyclicBarrier 和 Semaphore

    cdl用的是aqs,共享的是aqs那个volatile的state,阻塞线程列表用的也是aqs的 cb用的是reentrantlock+condition,当然rel用的也是aqs不过不同的是用的是互 ...

  4. 1.Python爬虫入门一之综述

    要学习Python爬虫,我们要学习的共有以下几点: Python基础知识 Python中urllib和urllib2库的用法 Python正则表达式 Python爬虫框架Scrapy Python爬虫 ...

  5. synchronized(三)

    package com.bjsxt.base.sync003; /** * 对象锁的同步和异步问题 * @author alienware * */public class MyObject { pu ...

  6. REST easy with kbmMW #16 – Multiple servers using HTTP.sys transport

    前文写过使用HTTP.sys转输层(TkbmMWHTTPSysServerTransport),实现一个kbmMW应用服务器. 如果在一台服务器上,同时运行多个,基于TkbmMWHTTPSysServ ...

  7. mysql检查-优化-分析

    Mysql分析.检查.优化表 l 分析表 对表进行分析(分析关键字的分布, 分析存储MyISAM等表中键的分布) MySQL中使用ANALYZE TABLE语句来分析表,该语句的基本语法如下: mys ...

  8. python cookies提取——从字符串到字典(一行Python代码)

    def extract_cookies(cookie): """从浏览器或者request headers中拿到cookie字符串,提取为字典格式的cookies&quo ...

  9. Java中的13个原子操作类

    java.util.concurrent.atomic包一共提供了13个类.属于4种类型的原子更新方式,分别是原子更新基本类型,原子更新数组,原子更新引用和原子更新属性.Atomic包里的类基本都是使 ...

  10. grep命令相关用法

    grep命令相关参数: -i:忽略大小写 --color:高亮显示匹配到的信息 -v:反向查找,没匹配到的行显示出来 -o:只显示被模式匹配到的串本身 正则表达式: .*:任意长度的任意字符,贪婪模式 ...