[New Feature] Workflow Performance Improvements

Hey @Zaque, good question. I just responded to @david17 and @anon38627393, where I think I pretty much answered this, but to sum it up, from the Bubble app’s perspective, workflows still run linearly. We just update the database in a more efficient way on the server-side. So everything should behave as it did before!

1 Like

It is now worthless :sweat_smile:

3 Likes

@petter Haha! Not true. Still so much value in there.

1 Like

Thank you for this new change! Welcome to the Bubble community too! :blush:

Thanks for the hard work - this is great news :smiley:

@jaakko @henryd Clearly state this it doesn’t change the workflow behavior. If you experience any issue, the first thing is to create a support ticket.

2 Likes

Am I crazy or are my pages navigating way faster as a result of this update? Would it have that kind of effect?

5 Likes

I noticed the same…

1 Like

I did notice that conditional-result caching has increased. If a conditional is evaluated once, the result is rubber-stamped to all equal conditionals throughout the workflow, the first time it was run in a DB-action chain.

I can see how this would greatly increase speed. However for workflows that require the equivalent conditional to actually be evaluated at that point, it would produce a logic error. For instance:

There are 5 A’s in a table.
Action 1: Make a change on the oldest A to change it to B IF there are >= 5 A’s
(Now there would be 4 A’s and 1 B)
Action 2: Exact same as above.

At this point there should be no change, as the DB state is <5 A’s. However, the conditional was evaluated once in Action 1 and then rubber-stamped into Action 2, hence action 2 would run even though the conditional would be logically false at that point.

Another example is a recursive API that goes:
Action 1: do something that references the first A you see
Action 2: delete the first A you see
Recursive call: run the workflow again if the first A you now see exists.

This recursive workflow would abort after the first run, as it caches the result of the first A in action 1, sees it no longer exists, and aborts, when logically it should be scanning for the next first A it sees.

The workaround to this is to try and change the conditional phrasing for each subsequent evaluation in a way that logically would produce the same result, but force the Bubble engine to encounter it as a new query and run it at that point. But I have some queries that simply can’t be rewritten, and for those I think the only remaining workaround is to call them in a successively-scheduled API.

1->2->3
becomes
1 -> calls API, API does 2->3.

So, in short, the process does not try to merge DB actions into a single-composite statement. But the conditional analyzer is caching based on the first example of a reused conditional it sees. This may not be totally intuitive to most users.

1 Like

Thanks Henry , could you list all the kind of actions that has been enhanced ?

1 Like

Thanks, great work!

1 Like

I’m just curious as to the why. Granted pages (when loading) will read from the DB to load the necessary data, but isn’t the workflow improvement for writing to the DB? Or is it both?

1 Like

I have no idea, I noticed a drastical improvement on a Personal plan. I guess things only keep getting better…

1 Like

Update: yesterday, we noticed that this change was breaking certain actions. As a few of you guessed in this forum thread, the issue was with actions that rely on database updates performed by previous actions. When actions were batched together, the database updates didn’t write to the database in time for the actions that relied on the database updates to see a change.

I’ve temporarily disabled batching (so the performance improvements are sadly reverted for the time being) while we investigate this issue. This should fix the issue.

3 Likes

Following up on my last reply to this thread: we’ve determined a fix to the problem that also preserves the performance gains in most cases. We’re going to hold off on the deploy until January just to be safe. Everything should be working fine now. Sorry for the trouble this caused and thanks to everyone who posted about the issue in this thread; the insights here really helped us to track down the bug!

6 Likes

Thank you! Great work.

Thank you sir! For our app, we mitigated a lot of the issue with API-chaining everytime we needed to ensure a conditional gets re-evaluated. The performance boost was noticeable and appreciated.

A small cultural suggestion, if I may? Is it possible for Bubble team shoot out an email when any anticipated prod change is scheduled to go in place, like an advice or notification of maintenance 24 hours prior? In the same nature as the automated cluster alerts or DB downtime alerts.

This way app owners can be at the helm and ready to halt any rouge processes should something unanticipated break in prod. We had 3 prod users get emailed something like 700 times inside a previously-stable recursive API that altered its behavior before we realized what was occurring and ceased the process. Really no big deal, but if a recursive Stripe charging API was running or something, things could’ve been a bit more serious. Such a small shift in operating procedure could give prod continuity oversight a serious boost! Appreciate it to both you and team for continuously striving to improve performance.

13 Likes

Second this. There needs to be some better standards in place for updates for production apps.

Tough part on their end is they can’t predict the endless number of ways we setup our apps, so they might think it’s a minor update but when in reality it’s critical to some - making it hard to tell us to be ready because I think they push updates almost daily.

5 Likes

Hello @henryd,

So is it deployed already or you will be deploying it in January?

Thanks a lot.

Love the intent here but it seems to have broken something along with it.
All of a sudden doing “Create a new thing…” in a custom event in one of my apps has ceased to work.
I can see it in debug_mode but when I check the database in the app editor it is nowhere to be found. Has someone else experienced similar and know what to do about it?