Sequential Story Execution / Execution Queues

I’d like to bring up an idea for discussion and hear what other people think about it.

I’ve been thinking about introducing the ability to control how Tines Stories execute, specifically the option to run an entire Story sequentially rather than allowing multiple executions to run concurrently.

The problem

One scenario where I think this could be particularly useful is IOC enrichment.

Imagine a platform sending multiple alerts into Tines, some of which contain the same IOC. This means multiple executions of the enrichment Story could end up processing the same indicator simultaneously.

This can introduce complications, particularly when working with shared records.

For example, let’s say an IOC record has a status field that tracks the enrichment process:

  • Pending

  • In Progress

  • Completed

  • Failed

If two executions attempt to process the same IOC at roughly the same time, they could both retrieve the same initial record state, update its status, perform enrichment, and eventually overwrite each other’s changes.

This can lead to duplicate records, conflicting status updates, unnecessary enrichment requests, and inconsistencies further down the workflow.

Of course, there are ways to mitigate these scenarios through additional checks, conditional logic and safeguards within individual Stories. However, I can’t help but wonder whether we’re sometimes solving a problem at the workflow level that could be addressed more elegantly at the platform level.


Another example: Alert ingestion and incident correlation

Another scenario I’ve encountered involves ingesting alerts from multiple endpoints (eight, in my particular case).

Each incoming alert passes through a Group responsible for:

  • Normalising the alert.

  • Checking whether the alert has already been seen (deduplication).

  • Determining whether the alert is new or previously known.

  • Identifying the incident associated with the alert.

  • Determining whether that incident is new or ongoing.

Depending on the source platform, alerts can arrive extremely quickly, sometimes with multiple alerts belonging to the same incident arriving within a very short timeframe.

The issue here isn’t necessarily Tines being slow. Processing an alert can involve external API requests, database lookups and other operations that naturally take time.

This creates a window in which multiple executions can be processing the same incident simultaneously.

For example, two alerts belonging to the same incident might both check whether an incident record exists before either execution has had the opportunity to create it. Consequently, both could conclude that the incident is new, when in reality they should have been associated with the same ongoing incident.

One possible workaround is to introduce throttling throughout the workflow. However, this comes with its own drawbacks. It increases execution times and introduces artificial delays, even when there isn’t necessarily a need to slow down processing.

I think this is another situation where controlling execution concurrency at the Story level could be beneficial.

The idea

What if we had the ability to configure a Story’s execution mode?

I envision something along these lines:

1. Concurrent execution (current behaviour)

Multiple incoming events can trigger independent Story executions, allowing them to run concurrently.

2. Sequential execution

Incoming events are placed into an execution queue and processed one at a time.

The next execution would only start once the previous Story execution has fully completed.

Ideally, this would be configurable at the Story level, allowing builders to choose the execution model that best suits their use case.

Where could this be useful?

I think this could be particularly valuable in workflows involving shared resources, external dependencies or operations where concurrent execution can introduce inconsistencies.

Some examples include:

  • IOC enrichment and threat intelligence processing.

  • Updating shared records or asset inventories.

  • Processing alerts that might reference the same entities or incidents.

  • Interacting with APIs that don’t handle concurrent requests particularly well.

  • Workflows where execution order and data consistency matter.

A few things worth considering

There are obviously some implementation details to figure out, such as how queued executions should behave when a previous execution fails, how queue limits should be handled, and whether this should eventually extend to shared queues across multiple Stories.

However, I think the underlying concept is worth exploring.

I’m aware that there are ways to work around concurrency-related issues today, but having this as a native execution option could simplify a lot of workflows and remove the need to implement custom concurrency management logic in individual Stories.

Rather than introducing additional throttles, delays and defensive logic everywhere, builders could simply tell Tines how they want their Stories to execute.

Curious to hear what everyone thinks! Have you encountered similar issues in your workflows, and would sequential Story execution or configurable concurrency limits be something you’d find useful?

2 Likes

Interesting, a classic race condition here… Although sequential story running may be valid in some forms/purposes, I am not sure if it would be here… You would not want your incident ingest story to be hanging/building up a queue of alerts that may be for completely unique incidents while it’s trying to process potentially 5-10 similar ones… I think for this, you would want ingest to be concurrent, but then when you get to the actual case/record part for incident correlation and creation, this is where further dedupe (if needed) or sequential parts could potentially exist. Enrichment for adding alternate source data to existing/same incident could potentially still be concurrent (if/where safe)

For my cases, most needed was a mutex or lock. One example: multiple alerts arriving rapidly. I still wanted the performance of parallel execution but accurately increment a counter on one record when duplicate. I have seen some systems have an atomic field update capability.
Another challenge is to accurately handle parallel processing of waves of ‘trigger’ and ‘resolve’ alert signals during large bursts or floods. You don’t want a ‘resolve’ signal to arrive, get processed before its ‘trigger’ leading to “found no matching record for this, dropping…” Then the ‘trigger’ finally lands and never gets resolved.