Enhance Mendix App Performance Using MxAssist Performance Bot

The Opportunity for Better Application Performance

Application performance is one of the key factors impacting a seamless and pleasant user experience. In today’s fast-paced environment, users have little patience for slow load times and connection issues.

While application performance depends on many factors, there are several Mendix-specific as well as common development patterns that can be followed to avoid performance degradation once a Mendix app is deployed. These are the hard-learned best practices gleaned over the years by the Mendix community and echoed in different places such as Mendix academy courses, the forum, training, and other documents.

We often see Mendix development teams spending substantial time training and enforcing these best practices. Even then, new developers will regularly make anti-patterns that are hard or time-consuming to spot. The statistical analysis of thousands of anonymized Mendix apps shows that many of them have considerable room to enforce performance best practices. For example, 70% of Mendix apps have one or more of the anti-pattern “committing every changed object inside a loop,” and around 45% of Mendix projects have several microflows that can be converted to nanoflows for better performance.

To address this, Mendix development teams use costly peer-review processes. One Mendix customer even mentioned a four-eye principle, where a team member should review each developer’s work to look for anti-patterns before it is committed. This means substantial review time, typically from expensive, experienced developers.

1_Application performance and the necessity of developer tools
Application performance and the necessity of developer tools

Introducing MxAssist Performance Bot

What if we could automate this peer review or at least part of it? What if there was a virtual co-developer—instead of your busy, experienced colleague—who could watch over your shoulder to spot and even fixes these issues? That’s what we’re aiming for by building MxAssist Performance Bot in Mendix 9.

MxAssist Performance Bot is an intelligent virtual co-developer bot that assists you in improving the performance of your app. It does this by inspecting your project model against Mendix development best practices in real-time while you are building your application in Mendix Studio Pro.

It is built using the statistical analysis of thousands of anonymized Mendix apps to learn common anti-patterns alongside the best practices refined by Mendix Expert Services and Mendix Most Valuable Partners (MVPs) while developing microflows, domain models, pages, etc.

Ronald Catersels, a Mendix MVP at Daywize, believes that “The advantage of these kinds of tools is that you already educate your developers because a junior developer will probably, after developing something, will go through the performance bot and see the statistics about the work they have done. I think junior modelers would really love stuff like this … it’s really useful to help them.”

How does MxAssist Performance Bot work?

In general, it provides three types or levels of assistance:

2_Three levels of assistance in MxAssist Performance Bot
Three levels of assistance in MxAssist Performance Bot

The first and perhaps the most crucial assistance is detection. Once triggered, the bot inspects the project model and identifies performance anti-patterns or, in other words, the missed performance best practice(s). To make it easier, the bot enables the developer to pinpoint and navigate to the specific document/element that contains the anti-pattern, as well as all the documents/elements that are impacted by that anti-pattern. This allows the developer to quickly find issues and deep dive into root causes and affected areas.

During our private beta testing, customers used the bot to check out some big Mendix projects they had built over several years. The bot detected hundreds of missing best practice cases, and in one project, thousands of them!

Ronald Catersels, a Mendix MVP at Daywize had this to say:

“What I like the most about the performance bot is the view and that it could give me an overview of all the things it says I need to look into. That was really helpful because our model was started in Mendix 2.3, and since then has migrated to Mendix 3, 4, 5, 6, 7, 8, and 9!”

3_Performance Bot Panel
Performance Bot Panel

Now, what if the bot lists all these issues? Then developers, especially novice ones, might start to think, “Why are these cases an anti-pattern in the first place? And what should we do about it?”

We believe that with any detection (diagnosis), a good explanation and recommendation (prescription) should come. That’s why the MxAssist Performance Bot explains an identified issue along with its potential impact and provides a step-by-step guideline on fixing the problem.

Ivo Sturm, a Mendix MVP at Firstconsulting, thinks the explanation “…helps to understand the recommendation, is helpful for junior dev, and gives a lot of context.”

Ronald Catersels, a Mendix MVP at Daywize, also finds it very interesting: “What I really liked is that I just could click on the link in the pop-up, and then it would immediately transfer me to the documentation and what you wrote about it and the explanation of why it’s highlighting these issues. That is really nice!”

 

4_ Performance Bot explanation and recommendation
Performance Bot explanation and recommendation

What if the bot could even fix the issue for you while you’re having a cup of coffee? Well, the MxAssist Performance Bot, upon developer acknowledgment, can, in some instances, automatically implement the best practice and fix the issue by refactoring the project model.

5_Performance Bot Auto refactoring
Performance Bot auto refactoring

Another exciting feature is the Configuration Panel, where you can choose a module or document and inspect it against a particular best practice. Any combination is possible! Let’s say a developer wanted to check a microflow against a specific best practice. They would navigate to the microflows section, click to check the microflow in question, and then select a particular microflow best practice they were curious about. After hitting ok, they would return to the Performance Bot panel and click on “Inspect” to detect any potential anti-pattern for the chosen microflow and best practice in the configuration.

Features like the Configuration Panel allow you to use the bot however you best see fit, giving you the power to create the best app possible while decreasing the time spent fixing and debugging after the fact.

6_Performance Bot configuration
Performance Bot configuration

When should you use MxAssist Performance Bot in your app development cycle?

You might ask when and how you should use the bot in your application development process. Of course, it’s up to your teams. Here is how some of Mendix developers think about it:

Mohammed Siddiqui, a Mendix MVP at Auraq, told us, “If I actually use it in a project, then what I would do is before doing any commit, once I finished the functionality, then I would just run a quick test to see if there is something that could be improved. And if there is, then I would just do those changes and then commit it. But maybe not every commit because I commit quite often, maybe after every story or after every functionality.”

Ibrahim, a Mendix developer at Emagiz, thinks that using MxAssist Performance Bot “…should be part of the definition of done. We can add a step to use PB before stories transfer to Done. Checking with Performance Bot will be part of the checklist that could be used in our team.”

Tudor Neacsu, a Mendix developer at Capegroep, shares a similar view: “After my story’s done, and I think I am ready for a review, I would first use the performance bot and then ask for a review after if nothing pops up from the performance bot … I think there should be some story in the sprint for going through them, investigating them, and then fixing them.”

What value can MxAssist Performance Bot provide?

Firstly, the MxAssist Performance Bot can make teams more efficient and productive by automatically detecting performance anti-patterns and reducing the need for peer reviews while educating new Mendix developers on best practices.

Mohammed Siddiqui, a Mendix MVP at Auraq, thinks that “Overall, this will make the life of the developer easier, especially the juniors, as well as including seniors and experts as well.”

Secondly, the MxAssist Performance Bot can increase the performance and quality of Mendix apps. We have done some performance improvement measurements using the Gatling framework towards Mendix runtime by executing a real Mendix project app. For example, we see excessive inheritance levels for entities, an anti-pattern detected by the bot, potentially leading to a significant performance degradation – up to 25% per specialization.

7_MxAssist Performance Bot value
MxAssist Performance Bot value

As Ivo Sturm, a Mendix MVP at Firstconsulting puts it, MxAssist Performance Bot can be used “as a learning tool for junior developers, and as a reminder for senior developers.”

Why don’t you give it a try? Next time you are modeling in Studio Pro 9, run the MxAssist Performance Bot. It might put a smile on your face. 🙂