Forum Academy Marketplace Showcase Pricing Features

[New Feature] Workflow Performance Improvements

Today, we’re excited to be rolling out a behind-the-scenes improvement to the way that workflows are run. Workflows with sets of consecutive actions that update the database are going to see performance improvements of around 25% (see below).

Some context: Each Bubble app has a server, maintained by Bubble, which stores its data. When a workflow changes an app’s data, the app sends an update to the server about the new state of the database. This operation can take a significant amount of time, so we would like to minimize the amount of times it is performed.

Previously, Bubble apps made changes to their database one action at a time. For example, if an app had a workflow where the first action is “Make a new thing”, the second is “Make changes to a thing”, and the third is “Delete a thing”, then it would update the database three separate times before proceeding with the next action in the workflow.

Now, Bubble apps are a bit smarter about the way they do this: if a workflow has a set of consecutive actions that require updating the database, the app will batch them all together, send one large update to the database, and continue with the rest of the workflow. Implementing this change led to a noticeable improvement in performance.

Below is a summary of the speed gains that were observed while testing these changes. As the size of the set of consecutive actions increases, so does the size of the speedup.

We hope you notice your workflows flowing a little faster today!

124 Likes

Thanks @henryd! Looking forward to the increased efficiency!

5 Likes

That’s awesome! Thanks so much.

2 Likes

That’s awesome, just in time for Christmas :mrs_claus: :slight_smile:

6 Likes

Nice work guys

3 Likes

Welcome @henryd!

Thank you for the update! Looking forward to seeing this in action. Thanks!!! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

  • One-on-One Tutoring
  • eLearning Hub
  • Video Tutorials
  • No-Code Classes
2 Likes

This is great news @henryd , and much desired. Quick question though - if a DB action creates a cascading action on the DB, prior to another DB action with a re-scan conditional on the DB, will the new process be able to account for that?

i.e.

Action 1: Insert new object with a flag of A amongst other objects with flags in domain {A,B,C}
Action 2: IF total count of A’s >20, make a change to first 5% A’s that exist, changing them to C’s
Action 3: Do some unrelated calcs and then Delete all C’s

Obviously, it would be impossible for these three actions to fit into one composite SQL statement. Does the new Bubble engine abort a composite statement if it detects conditionals or re-scans/searches on the DB in subsequent actions?

PS, I cannot stress the positive impact to our app this intelligence brings. Thanks Bubble team.

4 Likes

Many thanks!!!

1 Like

Awesome!

1 Like

Great. Thanks @henryd
Does this also improve the slow “Make changes to a list of things…” action ?

3 Likes

Always improving, that’s great!

1 Like

Great news!

2 Likes

Can you explain more about this batching? Similar to Jesse above, here’s a question about ordering…

Action A: Create item in Bubble DB
Action B: Create item via API
Action C: Edit A, with result from B.

If executed all at once, B may return empty.

Can you give some more details @henryd? @eve any idea if there’s more docs somewhere?

3 Likes

@henryd

I have similar questions as @david17 and @jesse.r.hunter… I assume the assumption is that we’re using the “result of prior workflow” steps to ensure things are run linearly, but there are various times where that is not an option.

1 Like

Great News!!!

2 Likes

Be interesting to see how this changes the guide :wink:

1 Like

Great question @jesse.r.hunter. In short, workflows of the type that you described above will still work under these new changes, and more generally all workflows should work exactly the same as they did before this update (and if you notice anything not working, please submit a bug report so we can put out a fix!)

I can certainly see why you would be curious about this, though. If the Bubble workflow engine wrote to the database by simply taking actions and translating them into SQL statements one by one, then we would be in trouble.

Thankfully, though, Bubble apps already send workflows to the server as a single chunk of data, so the workflow engine is able to ensure that actions that reference previous workflow actions run properly. This deployment doesn’t change the way that the server runs workflows, it just optimizes the way that updates that result from workflows are written to the database.

6 Likes

Hi @nicolas_dap—unfortunately, this change doesn’t affect “Make changes to a list of things” right now. However, we’re always working on workflow performance and it’s possible that we’ll be able to make improvements there in future changes.

4 Likes

So it sounds like the new “composite query builder” functionality is post-AST tree delivery / interpretation by engine. So a final statement-compression-check sort of thing, which is perfect. Thanks a bunch!

1 Like

Hi @david17, great question! I just responded to Jesse but I figured I would respond here as well.

First, I agree that the documentation surrounding this behavior could be a lot better. We’re working on improving our manual right now, actually, so hopefully that will clear up some of the confusion surrounding API workflows.

As you said, in the workflow example you gave, B may not finish running by the time Action C is run , and as a result Action C may not be able to edit A with the result of B. Today’s changes won’t alter this behavior, because it only batches together sets of consecutive actions which are of type “Create a new thing”, “Make changes to a thing”, or “Delete a thing”. Because “Schedule API Workflow” isn’t one of these three, there’s no chain of consecutive actions of these types in the example you gave, so none of the actions here would be batched together. Thus, this kind of workflow will behave the same as before today.

3 Likes