Bubble workload optimization – how to efficiently build your no-code app?
Bubble’s New Pricing Model: Workload Units (WU)
Bubble.io has recently announced a new pricing model for its users. The main price factor is the so-called “Workload Unit” (WU). It measures the computational resources required to perform application logic, such as data fetching, executing workflows, uploading files, loading pages, and making API calls. Workload units are allocated to these actions based on their complexity, with more intricate tasks consuming a greater number of units.
How to decrease workload of your Bubble app?
Workload optimization is not rocket science. There are several areas that affect your workload consumption. Let’s split it into a few areas and provide tips on how to make your app more efficient.
Data fetching, manipulation and structure
- Advanced filters: Don’t use advanced filters unless necessary. Bubble works in a way that this filtering occurs on the client-side, which means you need to fetch more data from the back-end and filter it on the front-end. If you can perform the search with a standard “Do a search for”, use it.
- Use a single data source: When fetching the same data in several places or in multiple steps within a single workflow, try to re-use the data source. For example, if you have a repeating group with a list of orders and you want to access that filtered list, avoid adding an additional “Do a search for”; instead, reference the Repeating Group’s “List of...”.
- Use cached aggregations: Bubble allows you to perform cached aggregations on lists of data. Use this especially if you are working with the same list on different pages and need to perform the same aggregation every time.
- Use stored aggregations: When you don’t need real-time data, store the calculated value and update it only when necessary (e.g., for "slowly changing" lists).
- Don’t create “things” because it’s easy: It is a common practice to use database records to store temporary data. However, every data operation requires WU. Avoid using database records for temporary storage; use custom states instead.
- Normalize your database: Use more data types with fewer fields instead of trying to fit all data into a single structure. This allows Bubble to fetch data more efficiently.
- Data search within a cell: If you have a repeating group with 50 rows and perform a “Do a search for” in each row, that is 50 database queries per page load, per user. Always look for a more efficient way to structure this data.
- Use DATA API for bulk operations: When you need to perform operations (especially creates) on a list of 20+ records, don’t use standard workflows. Bubble’s DATA API can significantly improve performance and efficiency for bulk operations.
- Autobinding vs. "Make changes to a thing": Autobinding is powerful but can be costly. Unless it is strictly necessary, use the "Make changes to a thing" action, especially if updating multiple fields at once.
Workflow optimization
- Be careful with “Do when condition is true”: If a complex workflow is triggered by “Do when condition is true” or “Do every X seconds” and it triggers frequently, it can quickly accumulate unnecessary workload units.
- Recurring workflows: These run on each element in a list on a regular basis. While helpful, they can consume a massive number of units if not managed carefully.
- Use result of Step X: Instead of performing repetitive data fetching, use the results of previous steps to access data. This minimizes database queries and enforces a synchronous order of actions.
- Make changes to a list vs. Recursive workflows:
- < 50 items: Use “Make changes to a list”.
- > 50 items: Use a recursive workflow instead.
- Frontend vs. Backend workflows: Executing the same actions is generally "cheaper" on the front-end. This is because part of the logic is executed by the user's browser resources rather than Bubble’s servers.
Page loading and frontend optimization
- Conditional expressions: Use them only when necessary. Expressions that require data fetching consume WU. Avoid placing these in repeating groups where the condition must be evaluated for each cell separately.
- Single vs. Multi-page apps: Each page load consumes workload units. Using a single-page application (SPA) structure can be more efficient as it avoids reloading the page and re-downloading data already fetched in previous views.
How to monitor your workload usage?
Fortunately, you can drill down into very specific details regarding what is driving your app’s WU consumption. Bubble provides an interactive WU dashboard where you can see exactly which operations and data searches are consuming the most units.
Interested in a free consultation for your existing Bubble application? Let’s schedule a short call to provide high-level recommendations on how to improve your existing Bubble app.