NanoProfiler

Content Type: Module
Categories: Tracing

Overview

A simple and lightweight profiling tool. It provides a function to easily measure the processing time in Microflow with a small footprint.

 

The innovative AutoMode NanoProfiler has been released at version2.0.0 !

Now, You no longer need to add logs or modify your microflows to monitor their performance. After starting AutoMode NanoProfier in AfterStartUp and configuring it a little, you can measure the execution time of all microflows at the individual action level without making any change in your app. Moreover, you can change profile settings of runnning apps and the measurement overhead is minimal.

Documentation

Description

NanoProfiler is a module for measuring the elapsed time of any section in your Microflow with a small footprint.It all works on-memory and doesn't use any Mendix Entity, so it's lightweight and fast.

Typical usage scenario

-To detect bottlenecks when tuning Microflow.-To monitor Microflow’s performance during operation.

What is AutoMode and StdMode?

AutoMode is a new mode that performs measurement automatically without adding measurement actions into individual microflows. In contrast, in the previous StdMode, it was necessary to add measurement actions into microflows, but measurement can be performed at any granularity.

AutoMode Getting started guide

Install NanoProfiler:  Install NanoProfiler from Market Place.

Add Configuration Page :  Add 'SNIP_AutoNanoProfilerConfig' to your apps page  to configure your Auto NanoProfiler .

Add to AfterStartUp Add ASU_AutoModeNanoProfiler to your App's AfterStartUp to start Auto NanoProfiler and restart app. It's recommend to call ASU_AutoModeNanoProfiler twice to launch two instances named 'SlowMicroflowMonitor' and 'MicroflowInspector'.

Enabling Auto NanoProfiler:  After restart, open Configuration Page and enable 'SlowMicroflowMonitor' with your preferred threshold millis, loglevel=WARNING, TraceActions=NO. Then, You can reconfigure a running Auto NanoProfiler instance by opening Instances Status and clicking Reconfig Request. This should be done for each node in a cluster configuration.

Useing Regexp filters:  Once you have detected a slow microflow using the 'SlowMicroflowMonitor', you can also enable the 'MicroflowInspector' following the same procedure, specify the desired microflow using Rgexp, and set TraceActions to true to obtain the execution time for each actions.

Scrutinize report:  Scrutinize the report that outputted to log in the following format.

### NanoProfiler Report: profileName=MyFirstModule.ACT_MyAction by AutoMode[SlowMicroflowMonitor] : totalTicks = 1038 : totalNanos = 210,614,600#### sectionName = [Start]-[Retrieve list of TimeZone from database] : executedCount = 1 : accumulatedNanos = 1,095,100 : averageNanos = 1,095,100#### sectionName = [Retrieve list of TimeZone from database]-[SUB_MySyb] : executedCount = 1 : accumulatedNanos = 14,372,500 : averageNanos = 14,372,500#### sectionName = [SUB_MySyb]-[Log message (info)] : executedCount = 518 : accumulatedNanos = 92,248,600 : averageNanos = 178,086#### sectionName = [Log message (info)]-[SUB_MySyb] : executedCount = 517 : accumulatedNanos = 102,243,900 : averageNanos = 197,763#### sectionName = [Log message (info)]-[End] : executedCount = 1 : accumulatedNanos = 654,500 : averageNanos = 654,500

 

StdMode Features and limitations

StartNanoProfiler ActionStart the profiler. You can create multiple profilers and use them at the same time. In that case, identify it with the handle returned by this Action.

TickNanoProfiler ActionProfile point name, elapsed time and number of calls.If an empty string (not empty but empty string) is specified as the handle and there is only one profiler started, it will be recorded in that profiler.This Action took only 19 microseconds each time measured with Mendix 8.12.7 on i7-10610U laptop. As a reference, an empty Java Action took 16 microseconds on the same measurement.

LogNanoProfileAsInfo/Debug/Trace ActionOutput profile results to logger as Info/Debug/Trace like below.The total processing time between each point recorded by Tick Action is output to the log. Please note that the unit is nanoseconds. 1,000,000 nanoseconds is 1 millisecond. SectionName is a concatenation of pointName specified in TickAction.### NanoProfiler Report: profileName=ACT_Sample : totalTicks = 59 : totalNanos = 8,953,800#### sectionName = Start ACT_Sample-After Logging : executedCount = 1 : accumulatedNanos = 62,600 : averageNanos = 62,600#### sectionName = After Logging-After Retrieve User : executedCount = 1 : accumulatedNanos = 3,605,700 : averageNanos = 3,605,700#### sectionName = After Retrieve User-Start Loop Process : executedCount = 1 : accumulatedNanos = 188,700 : averageNanos = 188,700#### sectionName = Start Loop Process-Enter SUB_Sample : executedCount = 14 : accumulatedNanos = 1,595,100 : averageNanos = 113,935#### sectionName = Enter SUB_Sample-Leave SUB_Sample : executedCount = 14 : accumulatedNanos = 1,217,300 : averageNanos = 86,950#### sectionName = Leave SUB_Sample-End Loop Process : executedCount = 14 : accumulatedNanos = 740,800 : averageNanos = 52,914#### sectionName = End Loop Process-Start Loop Process : executedCount = 13 : accumulatedNanos = 1,481,600 : averageNanos = 113,969#### sectionName = End Loop Process-END ACT_Sample : executedCount = 1 : accumulatedNanos = 62,000 : averageNanos = 62,000

StopNanoProfiler ActionStop the profiler. This module has a mechanism to automatically release the related internal resource after the reference to Handle returned by StartNanoProfiler Action is lost, but it is usually recommended to explicitly stop and release the resource. 

Dependencies

- There is no dependency on other modules.- About Mendix modeler version, you can see it on Usage section.

Installation

You can download and install the module from the App Store on Studio Pro in the regular way.

Configuration

Add the NanoProfiler action to the Microflow you want to measure by referring to the sample image.

Known bugs

There is no known bugs.

 

Releases

Version: 2.0.1
Framework Version: 9.24.2
Release Notes: Added sort order to auto mode configuration list. Added config name to auto mode log.
Version: 2.0.0
Framework Version: 9.24.2
Release Notes: AutoMode NanoProfiler has been released.
Version: 1.1.0
Framework Version: 9.24.2
Release Notes: Compatible with v9.24.2 or higher.
Version: 1.0.1
Framework Version: 8.12.7
Release Notes: Added total tick count to log.
Version: 1.0.0
Framework Version: 8.12.7
Release Notes: First release.