CAPE digital solutions

Top 3 Tips for better performance when working with big amounts of data in Mendix

So, you’ve built an amazing Mendix app that’s crunching through data like a champ. But now, as your data grows, your app is starting to move at the speed of a sloth on vacation. 

Don’t worry, we’ve all been there—watching our brilliant creation slow down under the weight of all that glorious data. But fear not!

With a few clever tweaks, you can turn your app back into the speedy, data-crunching machine it was meant to be. In this post, I’ll share my top three tips for turbocharging your Mendix app when it’s dealing with mountains of data. 

Get ready to say goodbye to sluggish performance and hello to an app that’s as fast as your morning coffee on a Monday!

In this blog

Author of the blog:

Limit the Data Loaded Initially when showing pages

Why It Matters: Loading too much data at once can significantly slow down your application, especially if the lists are large. This can lead to long wait times for users, increased load on your server, and a generally poor user experience. By limiting the initial data load, you ensure that your application remains responsive and user-friendly, even when dealing with large datasets.

How to do this:

  • Use filters to load only what you need right now. In the OG datagrid there is an option to only start retrieving the data after filters have been entered. But it’s also possible to build this as custom functionality for your datagrid 2 or other data containers. This will help with quickly loading pages that show a lot of data.
  • Serve your data in bite-sized chunks with pagination. Do this by creating a snippet with gird controls and retrieving the data using the offset and amount settings.

Optimize XPath Queries

Why It Matters: XPath queries are like treasure maps. The better the map, the faster you find the treasure. An optimized query ensures you get your data quickly without getting lost. Poorly optimized queries can lead to slow data retrieval, high server load, and frustrated users. By optimizing your XPath queries, you make your data retrieval process more efficient, reducing server load and improving response times

How to do this:

  • Index attributes that you query often. Indexing attributes wil really help the speed when retrieving data. Although sometimes they can easily be forgotten. The Mendix Best Practice bot will always let you know then you retrieve data from an attribute that isn’t indexed, so always keep an eye on that.
  • Avoid complex OR conditions that will slow things down.
  • Break it down! Simplify queries into smaller parts to keep things running smoothly.

Set up Microflows and Nanoflows Efficiently

Why It Matters: Properly using microflows and nanoflows can minimize the amount of data processed at any given time, improving overall performance. Microflows run on the server, while nanoflows run on the client side. Efficient use of these flows ensures that heavy processing tasks don’t bog down your server and that data is processed as close to the user as possible. This can significantly reduce latency and improve the user experience. Furthermore, small optimizations in working with lists in microflows can significantly improve the process time.

How to do this:

  • Use nanoflows for client-side tasks to lighten the server’s load. Also here the Mendix best practice bot will let you know when there are microflows that can be converted to Nanoflows. Keep an eye out for that!
  • Divide complex microflows into smaller, reusable pieces.
  • Ensure microflows handle only the necessary data, avoiding unnecessary loops over large lists.
  • Limit database retrieves in a loop. Try to retrieve the whole list of object you need outside the loop and use the “Find” functionality to search in that list. This prevents making a connection to the database for every iteration of the loop.
  • Be smart about using the “continue event” or the “Break event”. Make sure you don’t continue the loop when you don’t have to.

Conclusion

With these tips, you’ll turn your Mendix applications from sluggish to snappy in no time! Limit your data loads, optimize those XPath queries, and let microflows and nanoflows do the heavy lifting. Your app will thank you, and so will your users.

CAPE & Mendix

At CAPE, we’ve empowered numerous companies with self-enablement, guiding them right from the outset. From establishing foundational elements to strategizing complexities and architecture, we ensure that your team is well-equipped to embark on its low-code development journey. 

Our comprehensive approach includes hands-on training for your employees, ensuring they possess the skills and knowledge necessary to kickstart your own in-house development team. With our support, you’ll be fully prepared to leverage the Mendix Best Practice Bot and other powerful features, propelling your organization towards efficient and independent app development.

Learn more

Learn more about how we can help your company. Visit our services page for more details.

Schedule a no-obligation conversation or join our “App-in-a-morning” session, where we demonstrate the power and speed of developing applications in Mendix.

Make the future happen with CAPE Digital Solutions. 

Chelsea Veenstra