Bubble Docs
  • Introduction
  • New? Start Here
  • What is Bubble?
  • The Glossary
  • User manual
    • Getting started
      • What is Bubble?
      • Building your first app
        • Planning features
        • Database structure
        • Design and UX
        • eCommerce and payments
          • Shopping cart
          • Checkout page
          • One-time payments
          • Subscriptions
          • Marketplace
      • Creating and managing apps
      • The Bubble editor
        • Tabs and sections
          • Design tab
            • The element tree
            • The property editor
          • Workflow tab
          • Data tab
          • Styles tab
          • Plugins tab
          • Settings tab
            • Application settings
              • Custom headers/body
              • Visual settings
              • Social media sharing
              • Translating your app
              • Email settings
              • Collaboration
            • Custom domain and DNS
          • Logs tab
        • Tools
          • Key features
          • The search tool
          • The Issue Checker
          • The element tree
          • The element property editor
          • The debugger
          • Notes
        • Previewing your app
      • Transitioning to Bubble from...
        • JavaScript
        • HTML and CSS
        • SQL
    • Design
      • Elements
        • The element hierarchy
          • The element tree
        • The page
        • Containers
          • Groups
          • Repeating groups
          • Table elements
          • Popups
          • Floating groups
          • Group focus
        • Visual elements
        • Input forms
          • Text and numbers
          • Dates and time
          • File uploads
          • Selection controls
        • Reusable Elements
      • Styling
        • Color variables
        • Font variables
        • Styles
        • Custom Fonts
      • Responsive design
        • Building responsive pages
        • Legacy articles
          • The Basics (Legacy)
          • Building Responsive Pages (Legacy)
          • Migrating Legacy Pages
          • Tips When Designing (Legacy)
      • Templates
      • The Component Library
      • Importing from Figma
    • Data
      • The database
        • Data types and fields
        • Creating, saving and deleting data
        • Finding data
        • Displaying data
        • Protecting data with privacy rules
        • The database editor
        • Export/import data
          • Exporting data
          • Importing data (CSV)
        • Working with location data
        • Using Algolia
        • Database structure by app type
          • Marketplace Apps
          • Directory & Listings Apps
          • Social Network Apps
          • SaaS Apps
          • Project Management Apps
          • CRM Apps
          • Professional Services Apps
          • On-demand Apps
          • Documentation/ CMS Apps
          • Applicant Tracking System (ATS) Apps
          • Portfolio Apps
          • Gallery Apps
          • Online Store / Ecommerce Apps
          • Blog Apps
          • Messaging App
          • Dashboards
          • Building Block Apps
          • Bubble as a backend
      • Files
      • Images
      • Static data
        • App texts (translations)
        • Option sets
      • Temporary data
        • Custom states
        • URL parameters
      • User accounts
        • Authentication plugins
          • Facebook plugin
          • Fitbit plugin
          • Google plugin
          • Instagram plugin
          • LinkedIn plugin
          • Pinterest plugin
          • Slack plugin
          • Wistia plugin
          • YouTube plugin
        • Cookies set by Bubble
      • Time, dates and time zones
    • Logic
      • The frontend and backend
      • Workflows
        • Events
          • Frontend events
            • Recurring workflows
            • Custom events
          • Backend events
            • Database trigger events
        • Actions
        • API Workflows
      • Dynamic expressions
      • Conditions
      • Navigation
        • Single-page applications (SPA)
        • Multi-page applications
        • Page slugs
    • Workload
      • Understanding workload
        • Activity types
        • The workload calculation
        • Client-side and server-side processing
      • Tracking workload
        • Measuring
          • Using App Metrics
        • Monitoring
          • Workload notifications
          • Infinite recursion protection
      • Optimizing workload
        • Optimization framework
        • Optimization checklist
          • Page load
          • Searches
          • Workflows and actions
          • Backend workflows
        • Agency showcases
          • Minimum Studio
          • Neam
          • Support Dept
    • Security
      • Bubble's security features
      • Planning app security
      • Client-side and server-side
      • Bubble account security
      • App security
      • Page security
      • Database security
      • API security
        • API Connector security
        • Data API security
        • Workflow API security
      • Flusk
        • Overview
        • Flusk plan features
        • Getting started with Flusk
        • Flusk security tools
          • The Issues Explorer
          • Issue details
          • Tools and settings
            • Pages rating
            • Database rating
        • Flusk FAQ
      • Cookies
      • Security checklist
    • Publishing your app
      • Web app
      • Native mobile app
        • Global native mobile settings
        • iOS App Store
        • Google Play Store
        • Publishing FAQ
    • AI
      • Generate apps with AI
        • About AI app generation
      • AI page designer
      • Connect to AI agents
    • Maintenance
      • Collaborators
      • Version control
        • Best practices: Version control
        • Transitioning from the legacy version control
        • Terminology: Version control
        • Version Control (legacy)
      • Commenting
      • Database maintenance
        • Copying the database
        • Restoring database backups
        • Bulk operations
          • Bulk operation methods compared
        • Wiping change history
      • Performance
        • Hard limits
        • Capacity Usage (legacy)
        • Notes on queries
      • SEO
        • Introduction to SEO
        • SEO: App
        • SEO: Page
      • Testing and debugging
        • Introduction to testing and debugging
        • The debugger
        • The server logs
        • Supported browsers
      • API workflow scheduler
    • Integrations
      • API
        • Introduction to APIs
          • What is a RESTful API?
        • The Bubble API
          • Bubble API terminology
          • Authentication
            • How to authenticate
            • No authentication
            • As a User
            • As an admin
          • The Data API
            • Data API Privacy Rules
            • Data API endpoints
            • Data API requests
          • The Workflow API
            • Workflow API privacy rules
            • Workflow API endpoints
            • API workflows
              • Creating API workflows
              • Scheduling API workflows
              • Recursive API workflows
              • API Workflow Scheduler
              • Case: Stripe notifications
        • The API Connector
          • Authentication
          • API Connector security
          • API guides
            • OpenAI
              • Authentication
              • Calls
                • ChatGPT
                  • Chat
            • Google Translate
              • How to setup Google API keys
          • Streaming API
        • API security
        • Plugins that connect to APIs
        • API Glossary
      • Plugins
        • What Plugins Can Do
        • Installing and using Plugins
        • Authentication plugins
        • Special Plugins
      • SQL Database Connector
      • Bubble App Connector
      • WorkOS
        • WorkOS SSO
        • WorkOS API
    • Infrastructure
      • Sub-apps
      • Bubble release tiers
      • Hosting and scaling
        • How Bubble hosting works
        • Scaling with Bubble
        • CDN (Cloudflare)
        • Bubble app names
        • Domain and DNS
      • Compliance
        • GDPR
        • SOC 2 Type II
        • HIPAA
        • Other frameworks and standards
    • Bubble for Enterprise
      • Hosting and infrastructure
        • Dedicated instance
          • The Dedicated editor experience
          • Technical specs
          • Main cluster dependencies
          • Customizable options
          • Migration process
            • Pre-migration
            • During migration
            • Post-migration
      • Security and compliance
        • Single sign-on (SSO)
        • GDPR
        • SOC 2 Type II
        • HIPAA
        • Other frameworks
        • Bubble's security features
      • Admin and collaboration
      • Priority support
      • Billing and Payment Guideline for Dedicated Instances
  • Core Reference
    • Using the core reference
    • Bubble's Interface
      • Design tab
      • Design tab (Legacy)
      • Workflow tab
      • Data tab
      • Styles tab
      • Styles tab (Legacy)
      • Plugins tab
      • Settings tab
      • Logs tab
      • Template tab
      • Toolbar
      • Top and context menu options
      • Deployment and version control
        • Deployment & Version Control Dropdown (legacy)
      • Notes
    • Elements
      • General properties
      • General properties (Legacy)
      • Styling properties
      • Styling Properties (Legacy)
      • Responsive Properties
      • Responsive Properties (Legacy)
      • Conditional formatting
      • States
      • Page Element
        • Page Element (Legacy)
      • Visual Elements
      • Containers
      • Container Layout Types
      • Containers (Legacy)
      • Input Forms
      • Reusable Elements
      • Element Templates (legacy)
    • Workflows
    • Events
      • General events
      • Element events
      • Custom events
      • Recurring event
      • Database trigger event
    • Actions
      • Account
      • Navigation
      • Data (things)
      • Email
      • Element
      • Custom
    • Data
      • Data Sources
      • Operators and comparisons
      • Search
      • Privacy
    • Styles
    • API
      • The Bubble API
        • The Data API
          • Authentication
          • Data API endpoints
          • Data API requests
        • The Workflow API
      • The API Connector
        • Authentication
        • Adding calls
    • Bubble-made Plugins
      • AddtoAny Share Buttons
      • Airtable
      • API Connector
      • Blockspring
      • Box
      • Braintree
      • Bubble App Connector
      • Chart.js
      • Circle Music Player
      • Draggable Elements
      • Dropzone
      • Facebook
      • Fitbit
      • Full Calendar
      • Google
      • Google Analytics
      • Google Optimize
      • Google Places
      • Ionic Elements
      • iTunes
      • Slidebar Menu
      • LinkedIn
      • Localize Translation
      • Mixpanel
      • Mouse & Keyboard Interactions
      • Multiselect Dropdown
      • Progress Bar
      • Rich Text Editor
      • Rich Text Editor (Legacy)
      • Screenshotlayer
      • SelectPDF
      • Slack
      • Segment
      • Slick Slideshow
      • SQL Database Connector
      • Star Rating
      • Stripe
      • Tinder-like Element
      • Twitter
      • YouTube
      • Zapier
    • Application Settings
      • App plan
      • General
      • Domain / email
      • Languages
      • SEO / metatags
      • API
      • Collaboration
      • Sub-apps
      • Versions
  • Account & Marketplace
    • Account and billing
      • Pricing and plans
        • Plans and billing
        • Billing cycle
        • FAQ: Pricing and Workload
      • Account Management
      • Building Apps for Others
      • Selling on the Marketplace
      • Plans & Billing (legacy)
    • Official Bubble Certification
      • Hiring certified developers
    • Building Plugins
      • The Plugin Editor
      • General Settings
      • Updating to Plugin API v4
      • Adding API Connections
      • Building Elements
      • Building Actions
      • Loading Data
      • Publishing and versioning
      • Github Integration
    • Building Templates
    • Application and data ownership
    • Marketplace policies
    • Bug reports
  • Vulnerability Disclosure Policy
  • Beta features
    • About the Beta features section
    • Native mobile apps 🔒
      • Introduction
        • What is a native mobile app?
        • Native mobile vs. web development
        • Differences in native and web elements
        • Native mobile app terminology
      • Building
        • Views and navigation
        • Native mobile actions
        • Components and gestures
        • Device resources
          • Location services
          • Camera/photo library
      • Previewing
      • Publishing
Powered by GitBook
On this page
  • Workflow volume
  • The total calculation of an action
  • Number of actions
  • Working with lists of things
  • Do when condition is true and conditions
  • The order in a conditional expression
  • Summary
  • Other ways to learn

Was this helpful?

  1. User manual
  2. Workload
  3. Optimizing workload
  4. Optimization checklist

Workflows and actions

Last updated 11 months ago

Was this helpful?

This article series on workload will sometimes reference documentation shared in other parts of the series, as well as the core reference entry for workload. We recommend you get to know the core reference entry, and proceed to read the series as a whole (in that order).

Reference: Article series:

In the earlier article , we explored the theme park entry ticket metaphor to illustrate that the reflects the cost of entry, but you can still add additional workload by accessing different rides inside of the park.

This is especially true for ; each workflow can have a very low or even zero entry cost, but as you add to it, the number and complexity of server requests can go up accordingly.

Keep in mind that a workflow is the umbrella term for the combination of an event and one or more actions – like a folder. As such, a workflow doesn't in itself consume any WU at all, but instead each event and action leaves a footprint. This is not just semantics: it's a helpful way to focus on the right things: instead of thinking of a workflow spending a given amount of workload, we can focus on the event and the actions in isolation.

In this article, we'll continue looking at how different workflows – and the operations that you add to a workflow – contribute to the net total.

Workflow volume

Before we dive in, we'll repeat a point from earlier: each workflow in isolation does not usually incur a substantial workload cost. Of course, it still makes sense to optimize each and every workflow to be as efficient as it can be without compromizing on UX or features, but there are also deadlines and developer resources to think about.

The way to prioritize, is to look at workflows that have two similarities in common:

  • They contain operations that typically consume a relatively high amount of workload, such as:

    • Complex database searches

    • Changing/copying/deleting a list of things

    • Scheduling bulk operations (API workflows on a list or recursive workflows)

  • They are repeated frequently, such as:

    • Many times per user

    • Many times as a result of user growth

What we can learn from this is that a "heavy" operation that runs infrequently is not necessarily a big consumer of workload. Likewise, a frequent operation that is very lightweight is not necessarily worth optimizing. As you plan your workloads, try to identify those that spend a high amount over time. These are the ones that you want to try to optimize.

The total calculation of an action

Like we've done a few times in this article series, we'll have a look at how running an action is akin to the "entry ticket" metaphor.

In the example above, we want a list of Products to have a price that's an average of another list of products. Let's look at what we're doing:

  • First, we're starting the Make changes to a list of things action

    • The total cost of the operation depends on the volume of the list and the number of changes being made

  • Then, we perform a Do a search for to find the list of Products we want to make changes to

  • Then, to make the requested change, we use another Do a search for and add the average operator to calculate the final price.

As we've seen in some of the earlier examples, it's important to be aware of the total work we're asking the server to do. We are not just running the Make changes to a list action, but also performing two database queries (Do a search for).

There are not necessarily any more efficient ways to do this: Make changes to a list of things is still more WU-friendly than and . Make changes to a list of things works well for smaller lists (up to a few hundred things), but may if the list is too long.

The purpose is not to caution against the use of this action or its searches, but to further illustrate that WU consumption does not only depend on the specific action, but on other factors, as we listed above.

Number of actions

The number of actions in a workflow has an impact on WU. With that in mind, when you develop your app and plan for WU consumption, it makes sense to think of each action in isolation rather than each workflow. A workflow in itself doesn't incur any cost; it's just the combination of a trigger and a collection of actions – a folder, if you will.

There are a few things you can do to reduce the number of actions running in a workflow:

  • Consider each action and see if it's needed

  • Can one or more action be combined into one?

  • Do all actions have to be executed every time the workflow runs, or could you stop one or more of them from running by using the action?

Working with lists of things

Some actions work with a list of database things, as opposed to just one thing. Although these actions can be very useful, it's worth noting that processing a list of things demands more from the server compared to handling a single item, resulting in a greater WU cost. Actions include:

  • Make changes to a list of things

  • Delete a list of things

  • Copy a list of things

Using these actions is still less costly than using Schedule API workflow on a list or a recursive workflow. As such, it's important to note that we're not cautioning against their use – but merely pointing out that working with lists gives the server more work to do than working with a single item. Knowing that, you can make informed design and development decisions.

Do when condition is true and conditions

Do when condition is true works by checking a condition to see if it's true, and executing a workflow if it is. Do when condition is true is based on dynamic expressions, that can happen client-side or server-side, depending on what the condition is checking. Let's quickly look at a few examples.

As you plan your app's design and logic for WU, remember that WU management shouldn't be your sole focus. Server-side conditions offer more security compared to client-side ones. Therefore, for processes requiring heightened security, prioritizing security over WU considerations is often the smarter choice. You can read more about this in the article below:

1. Checking something in the database (server-side)

The database is stored and maintained securely on Bubble's servers. As such, any condition that requires communication with the database (whether it's creating, reading, updating or deleting something) will incur a slight WU cost.

It should be noted that this communication with the server can happen more often than you think:

  • As the condition is first checked, Bubble performs a database query

  • As your database is updated (by that user or anyone else), Bubble's server may send the updated information to the user's device, again incurring a small WU cost

Knowing this, we can again ask a few questions to optimize:

  • Is the workflow needed at all?

  • Does Run this - every time need to be selected, or can I reduce its frequency by instead selecting Just once?

  • Is there some way we can trigger it by something other than a server-side condition? Such as a client-side condition or user action?

  • The condition will usually be checked on page load. In other words, it will be checked every time a user loads a page. Can we avoid this somehow?

There are two lessons you should take away from this. The first is that the condition itself might incur a workload cost. The second is that the actions inside of that workflow may execute more often than you intended if you are not careful when setting up the Do when condition is true conditional expression.

2. Checking if an element is visible (client-side)

Let's have a look at another example. In this one, we are checking if a group element is visible in order to trigger the workflow:

Bubble can verify if a condition holds true directly on the user's device, meaning the check is done client-side and doesn't involve Workload Units (WU). This kind of condition is executed swiftly as it doesn't require server communication, but it's less secure.

Employ client-side conditions for workflows where security isn't a major concern.

The order in a conditional expression

The order in which you place multiple conditions in a dynamic expression can make a difference in your WU consumption (as well as the speed at which Bubble will complete checking the condition). Before we dive into the example, let's summarize the logic with two simple rules:

  • Bubble reads conditions from left to right

  • If any step connected with the and operator in the conditional expression returns a "no", Bubble will not check the rest of the conditions

In other words, Bubble doesn't do more work than it has to when checking conditions. If a condition has two steps (connected with the and operator, as opposed to the or operator), and the first condition returns a "no", the second step will be disregarded. You can use this to your advantage. Let's combine the two conditions from our earlier example to see how this can work in practice.

In the example above, the condition has two steps, combined with the and operator:

  1. Is the element called Group example visible?

    • and

  2. Is the number of users in the database more than 100?

If the first condition returns a "no", Bubble will not check the second, meaning that in that case, the condition has not incurred any WU cost. If you used the or operator, Bubble would have to check both of them, since any of them being true would return a "yes."

The example above would also be secure than only using a client-side condition. If a user was able to somehow manipulate the first step to return a "yes" you didn't intend, the second server-side condition still cannot be tampered with and will return the correct response.

Summary

Summary: Workflows, actions and workload

Let's go over the points we've covered in this article:

  • Workflows start with low impact but can increase in workload with added expressions and server-side actions.

  • Prioritize workflows that are both high in workload and frequently executed.

  • Consider overall workload, including associated database queries, not just the action itself.

  • Merge actions when possible and use "Terminate this workflow" to stop unnecessary operations.

  • Operations on lists are more demanding than single items.

  • Faster and don't add to workload but offer less security.

  • Bubble stops evaluating "and" conditions after a "no," which can reduce workload.

  • Optimize workflows for workload without compromising security or user experience.

Other ways to learn

Articles
Videos

Article: Article series:

Article series:

Article: (including Do when condition is true)

Page security
Security
Workflows
Custom events
Using the Do when condition is true event
Pricing and workload
Optimizing for workload
Understanding workload calculation
activity type/cost table
In this example we are running a workflow if he number of users in your app exceeds 100. Note that Every time is checked, which means that every time a new user is added to your app, the condition will be re-checked and the workflow will run.
In this example, we are checking something on the user's device: whether a group is visible. This doesn't need Bubble's server to get involved, and does not incur a WU cost. However, it's less secure.
In this example, the conditional expression has two steps: the first one is performed client-side, and the second one server-side.