How to effectively monitor the performance of Meteor projects?

Jan 15, 2021
Your app performance matters, and in a long run, it is one thing that can determine your success. An average app user is neither patient nor very forgiving, so if you do not monitor the performance of your Meteor projects, and users encounter technical issues, you have just lost your users.
In this article, we'll tell you about some low-hanging-fruits of performance and user experience monitoring.

Why is effective monitoring so important?

If you constantly monitor the performance of your Meteor projects, you might be able to:
  • spot technical issues before they arise
  • prevent losing users due to low user experience
  • predict scalability challenges in advance, and ultimately scale faster and better
When your application is your business, you need to keep it in the good condition to ensure business continuity. Certain development processes are both time- and money-consuming, so continuous performance monitoring is crucial in the development process when making changes is easier and cheaper than later on when the app is already in use. Moreover, monitoring the performance of your application helps you eliminate potential performance issues early on, and in the app business, any disruption in performance can be potentially lethal.
It is always better to prevent than heal, so monitoring your app’s performance is monitoring your own success rates. Even without technical problems, mobile app users are not easy to please: 25% of the apps are accessed only once after they are downloaded. To put things into perspective, the remaining users, who will last past the first stage of the app selection, have a low tolerance for downtime and other technical issues: for regular applications​, 59% of users think that 2 hours is the maximum “acceptable” downtime. For high priority applications, 52% of users think that more than an hour of downtime is unacceptable.
The cost of downtime may be extremely high.​ Your credibility, money, and users’ trust are all on the line, so let us discuss, step by step, the art of effectively monitoring your Meteor app to optimize your app performance and prevent technical issues in time.

Monitor user analytics to determine your performance goals

To determine your performance goals, you need to understand how your app interacts with users, and to do so, it is necessary to monitor your user analytics:
  • What are the most popular pages of the app?
  • Where most of your users come from?
  • What are the biggest resource drains for your app?
These are all important questions to answer because they show your app’s potential problem areas before they become big issues. To easily access all necessary analytics, you can simply integrate your application with Google Analytics using Google Tag Manager. The Google tool records all the page events, so it is easier to stay up to date with all the changes. You can also take advantage of custom event tracking functionality and track form submissions, or the user clicks on the ‘buy now’ button.

Develop an optimal deployment strategy for the app servers

One of the important things to determine is if your server reachability timing (RTT) is right. Returning to the subject of RTT — RTT, and query running time are important because people abandon slow-loading pages and apps with no regrets in around ​3 seconds! ​59% of visitors will not wait for more than 6 seconds for a page to load. RTT is most important for mobile apps and mobile experience.
You can test RTT with a ping tool to determine if your server responds fast enough for users, especially for countries, where most of your customers reside.
  • One of the most commonly used tools to manage your RTT is Lighthouse, “an open-source, automated tool for improving the quality of web pages”, which allows for auditing performance, accessibility, progressive web apps, and SEO, to name just a few options.
  • Another option is Google’s Web Vitals, which measures performance based on different metrics.
All of them are distinct facets of the user experience, which are measurable in the field, and reflect the real-world experience of a critical user-centric outcome.
You should look at the following statistics first:
  • Largest Contentful Paint (LCP) measures loading performance. In the ideal scenario, LCP should occur within 2.5 seconds from the moment the page starts loading.
  • First Input Delay (FID) is a measure of interactivity and it should be no more than 100 milliseconds.
  • Last but not least: Cumulative Layout Shift (CLS) is responsible for measuring visual stability and it should not exceed 0.1. If you meet all these metrics targets at least 75%, it means that your app performs well and your users can enjoy a satisfactory user experience.
Important note: Lighthouse does not support measuring of FID, so it is recommended to replace it with the measuring of Total Blocking Time (TBT), which assesses load responsiveness.

Monitor your app performance with Kadira APM

One of the best ways to monitor the performance of Meteor applications is Kadira APM, an open-source tool for Meteor performance monitoring. How does Kadira work? It compares regular client and server-side observations to determine an application performance. Kadira shows you the current and past behavior of your application based on several metrics.
With the tool’s help, you can analyze DDP response time and live query usage, which is the technology responsible for changing data automatically in real-time. If certain publications are used by many users, or things change very dynamically, live query metrics usage can tell you a lot about your app’s performance.
Important note: you can either host Kadira on your own, use Monti APM, or Meteor APM, which is available in the Galaxy Professional plan. It is all the same software but from different providers.

Things to pay attention to when you monitor your Meteor project

You can easily correlate performance issues with logs and alerts in Meteor if you use ELK stack or Datadog. Otherwise, you have no other choice than manually compare logs with APM metrics. If you want to manually instrument your code for Meteor performance testing, you can do so by running --inspect and --inspect-brk command-line flags. It will give you access to the interface of Node.js Debugger, which includes a few useful tools, such as a memory analyzer. What kinds of metrics should you use in Meteor performance testing processes?
  • CPU/RAM usage
  • Traffic metrics such as web response time, proxy overhead, active sessions
  • Node.js specific metrics: event loop delay, open handles/requests, allocated/used memory
  • Meteor specific metrics: publication time and methods, the number of observers on the database (active live queries), the number of published documents

Spot your app issues before they turn into your app disasters

All in all, monitoring the performance of your Meteor app may require many steps and attention to every detail, but it is a necessary maintenance activity, which helps you avoid technical issues and prepares you for the process of scaling up. The smaller your application, the easier it is to eliminate problems before they turn to app disasters.
Constant monitoring of your app will make it more manageable for you to determine the next steps in the development process. Observe, which parts of the app impact your users the most, spot potential problem areas before your users do, and enjoy user trust more and more every day. Your path to success might not turn out to be a straight line, but it will surely be less bumpy from the very start if you always monitor what must be monitored, and optimize what can be optimized.