In-memory Models Management: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
In-memory models management is about determining, how many models can be loaded in-memory and how long filter eventlogs and calculation result caches are kept in the memory, which balance between performance and memory consumption. Note that this article only concerns the in-memory models in QPR ProcessAnalyzer.
Managing in-memory models means how many models can be loaded in-memory at the same time and how long filter eventlogs and calculation result caches are kept in the memory. Note that this article only concerns the in-memory models in QPR ProcessAnalyzer.


== Memory usage behavior==
== Memory usage behavior==
QPR ProcessAnalyzer uses the automatically running garbage collection mechanism which releases unused objects from the memory when the system needs more resources to store new objects. When models are loaded into memory, QPR ProcessAnalyzer (IIS worker process) memory consumption increases. When models are dropped, memory resources are released. The memory consumption doesn't decrease instantly, and this is because the garbage collection might not run immediately if there is no need for more memory resources. When there is lack of memory, the reserved memory is freed by the garbage collection if it's not used by QPR ProcessAnalyzer. When models are loaded into memory after dropping models, the memory consumption might not increase because the reserved memory (previously used by the dropped models) can be used by the newly loaded models.
QPR ProcessAnalyzer uses the automatically running garbage collection mechanism which releases unused objects from the memory when the system needs more resources to store new objects. When models are loaded into memory, QPR ProcessAnalyzer (IIS worker process) memory consumption increases. When models are dropped, memory resources are released. The memory consumption doesn't decrease instantly, and this is because the garbage collection might not run immediately if there is no need for more memory resources. When there is lack of memory, the reserved memory is freed by the garbage collection if it's not currently used by QPR ProcessAnalyzer. When models are loaded into memory after dropping models, the memory consumption might not increase because the reserved memory (previously used by the dropped models) can be used by the newly loaded models.


When using a model (e.g., opening dashboards), the memory consumption further increases because filter eventlogs are cached to the memory. If there is lack of memory, older filter eventlogs are dropped from the memory to get more space. This on the other hand decreases performance because if the filter eventlog is needed again, it needs to be recalculated.
When using models (e.g., opening dashboards), the memory consumption further increases because filter eventlogs are cached to the memory. If there is lack of memory, older filter eventlogs are dropped from the memory to get more space. This on the other hand decreases performance because if the filter eventlog is needed again, it needs to be recalculated.


Loaded models are never dropped from the automatically but only when explicitly requested by a user. This is because loading a model from the database usually quite slow operation. When trying to load more models than there is available memory in the server, an out of memory error situation may occur.  
Loaded models are never dropped from the automatically but only when explicitly requested by a user. This is because loading a model from the database usually time consuming operation. When trying to load more models than there is available memory in the server, an out of memory error situation may occur and the QPR ProcessAnalyzer server may restart itself.  


The rest of the memory is available for other cached objects, and they may be dropped if memory is becoming full. The more there is memory available, the better the performance because models and calculation results are more often available in the memory cache (i.e., higher hit rate). QPR ProcessAnalyzer is thus flexible in terms of the memory usage, as it will use more memory if there is memory available, but it can also work with less memory (although with decreased performance). If the QPR ProcessAnalyzer server doesn't have enough memory to store more objects, already stored filters and calculation results are dropped from the memory starting from the one having the longest time since the last usage. Thus, when there is a memory shortage, objects may be dropped earlier than their settings define.
Memory not used by model eventlogs, is available for other cached objects, and they may be dropped automatically if memory is becoming full. The more there is memory available, the better the performance because requested filters and calculation results are more often available in the memory cache (i.e., higher hit rate). QPR ProcessAnalyzer is thus flexible in terms of the memory usage, as it will use more memory if there is memory available, but it can also work with less memory (although with decreased performance). Filters and calculation results are dropped starting from the one having the longest time since the last usage. Thus, when there is a memory shortage, objects may be dropped earlier than their default preservation settings define.


== Memory usage monitoring ==
== Memory usage monitoring ==
QPR ProcessAnalyzer memory usage can be monitored in following sources:
QPR ProcessAnalyzer memory usage can be monitored in following sources:
* Server Windows Task Manager shows how much memory is reserved to QPR ProcessAnalyzer (i.e., the IIS worker process, w3wp.exe).
* Windows Task Manager shows how much memory is reserved to QPR ProcessAnalyzer server (i.e., IIS worker process, w3wp.exe).
* [[Navigation_Menu#User_Settings|User Settings]] dialog in the QPR ProcessAnalyzer UI shows how much memory is used by QPR ProcessAnalyzer (click '''details''' and see '''QPR ProcessAnalyzer memory usage''').
* [[Navigation_Menu#User_Settings|User Settings]] dialog in the QPR ProcessAnalyzer UI shows how much memory is used by QPR ProcessAnalyzer (click '''details''' and see '''QPR ProcessAnalyzer memory usage''').


Based on the memory usage, it may be difficult to identify how much there is unused memory in the server because some of the memory may just be reserved to the w3wp.exe process but it's not currently in use by eventlogs. To see how much memory is actually in use, the administrator can run a manual ''garbage collection'' in the server. It can be done in the [[Navigation_Menu#Expression_Designer|Expression Designer]] by running the following commands:
Based on the memory usage, it may be difficult to identify how much there is unused memory in the server because some of the memory may be reserved to the w3wp.exe process but it's not in use. To see how much memory is actually in use, the administrator can run the ''garbage collection'' manually. It can be done in the [[Navigation_Menu#Expression_Designer|Expression Designer]] by running the following commands:
<pre>
<pre>
GarbageCollection();
GarbageCollection();
Line 29: Line 29:


== Best practices for memory management ==
== Best practices for memory management ==
Follow these best practices for the QPR ProcessAnalyzer server memory configuration:
Follow these best practices for managing and optimizing the QPR ProcessAnalyzer server memory usage:
* Make sure that the total Estimated memory usage as displayed in the [[Navigation_Menu#System_Reports|System Reports]] | Models is less than the amount of memory available for the QPR ProcessAnalyzer server. The Estimated memory usage takes into account the estimated memory consumption needed for simultaneous user sessions, cached filters, calculation results, working memory and other on-time required computing resources. The actual memory consumption for each model immediately after it has been loaded into the memory is lower than the Estimated memory usage. Please make sure there is enough memory available after the models have been loaded so that the simultaneous usage does not result in running out of memory.
* Make sure that the total ''Estimated memory usage'' as displayed in the ''Models'' ''[[Navigation_Menu#System_Reports|System Reports]]'' is less than the amount of memory available for the QPR ProcessAnalyzer server. The Estimated memory usage takes into account the estimated memory consumption needed for simultaneous user sessions, cached filters, calculation results, working memory and other on-time required computing resources. The actual memory consumption for each model immediately after it has been loaded into the memory is lower than the Estimated memory usage. Please make sure there is enough memory available after the models have been loaded so that the simultaneous usage does not result in running out of memory.
* Optimize the model content from the memory usage viewpoint. Usually, string type of data consumes most of the memory, and numbers, dates and booleans don't need that much memory. For strings, especially long texts and great number of unique texts consume lot of memory.
* Model content can be optimized from the memory usage viewpoint. Usually, string type of data consumes most of the memory, and numbers, dates and booleans don't need that much memory. For strings, especially long texts and great number of unique texts consume lot of memory. Consider whether the information can be expressed using numbers, dates and booleans, and prefer them over strings.
* Adjust the ''Drop Unused Filters After'' setting available for models (in the [[QPR_ProcessAnalyzer_Project_Workspace#Editing_Model_Settings|Model properties]] dialog) which determines the duration after which unused filter eventlogs are dropped from the memory. Lower values can be used when there isn't much memory available in the server. The Drop Unused Filters After setting is defined in format ''HH:mm:ss'' or ''d.HH:mm:ss'', for example 01:00:00 (one hour), 00:30:00 (30 minutes) or 1.00:00:00 (24 hours). If this setting is not defined, the server level [[Installing_QPR_ProcessAnalyzer_Server#Server_settings_file_(appsettings.json)|default setting]] is used. When any calculation is performed using a filter, the filter's last used time is updated.
* Disable extending memory into disk (the page file), because it will slow down the system remarkably. Instead, make sure that there is enough memory in the system for workloads for QPR ProcessAnalyzer. (more information: https://docs.microsoft.com/en-us/windows/client-management/introduction-page-file)
* Disable extending memory into disk (the page file), because it will slow down the system remarkably. Instead, make sure that there is enough memory in the system for workloads for QPR ProcessAnalyzer. (more information: https://docs.microsoft.com/en-us/windows/client-management/introduction-page-file)
* Configure the '''Drop Unused Filters After''' setting available for models (in the [[QPR_ProcessAnalyzer_Project_Workspace#Editing_Model_Settings|Model properties]] dialog). The setting determines the duration after which unused filters are dropped from the memory. The Drop Unused Filters After setting is defined in format ''HH:mm:ss'' or ''d.HH:mm:ss'', for example 01:00:00 (one hour), 00:30:00 (30 minutes) or 1.00:00:00 (24 hours). If this setting is not defined, the server level [[Installing_QPR_ProcessAnalyzer_Server#Server_settings_file_(appsettings.json)|default setting]] is used. When any calculation is performed using a filter, the filter's last used time is updated. Note that the allowed value for this setting is greater than zero seconds.


==Objects stored in memory==
==Objects stored in memory==

Latest revision as of 08:26, 26 September 2024

Managing in-memory models means how many models can be loaded in-memory at the same time and how long filter eventlogs and calculation result caches are kept in the memory. Note that this article only concerns the in-memory models in QPR ProcessAnalyzer.

Memory usage behavior

QPR ProcessAnalyzer uses the automatically running garbage collection mechanism which releases unused objects from the memory when the system needs more resources to store new objects. When models are loaded into memory, QPR ProcessAnalyzer (IIS worker process) memory consumption increases. When models are dropped, memory resources are released. The memory consumption doesn't decrease instantly, and this is because the garbage collection might not run immediately if there is no need for more memory resources. When there is lack of memory, the reserved memory is freed by the garbage collection if it's not currently used by QPR ProcessAnalyzer. When models are loaded into memory after dropping models, the memory consumption might not increase because the reserved memory (previously used by the dropped models) can be used by the newly loaded models.

When using models (e.g., opening dashboards), the memory consumption further increases because filter eventlogs are cached to the memory. If there is lack of memory, older filter eventlogs are dropped from the memory to get more space. This on the other hand decreases performance because if the filter eventlog is needed again, it needs to be recalculated.

Loaded models are never dropped from the automatically but only when explicitly requested by a user. This is because loading a model from the database usually time consuming operation. When trying to load more models than there is available memory in the server, an out of memory error situation may occur and the QPR ProcessAnalyzer server may restart itself.

Memory not used by model eventlogs, is available for other cached objects, and they may be dropped automatically if memory is becoming full. The more there is memory available, the better the performance because requested filters and calculation results are more often available in the memory cache (i.e., higher hit rate). QPR ProcessAnalyzer is thus flexible in terms of the memory usage, as it will use more memory if there is memory available, but it can also work with less memory (although with decreased performance). Filters and calculation results are dropped starting from the one having the longest time since the last usage. Thus, when there is a memory shortage, objects may be dropped earlier than their default preservation settings define.

Memory usage monitoring

QPR ProcessAnalyzer memory usage can be monitored in following sources:

  • Windows Task Manager shows how much memory is reserved to QPR ProcessAnalyzer server (i.e., IIS worker process, w3wp.exe).
  • User Settings dialog in the QPR ProcessAnalyzer UI shows how much memory is used by QPR ProcessAnalyzer (click details and see QPR ProcessAnalyzer memory usage).

Based on the memory usage, it may be difficult to identify how much there is unused memory in the server because some of the memory may be reserved to the w3wp.exe process but it's not in use. To see how much memory is actually in use, the administrator can run the garbage collection manually. It can be done in the Expression Designer by running the following commands:

GarbageCollection();
Sleep(2000);
GarbageCollection();
Sleep(2000);
GarbageCollection();
Sleep(2000);
"Memory consumption: " + Round((UsedProcessMemory / 1024 / 1024), 0) + "MB"

These commands runs the garbage collection three times and after that shows the QPR ProcessAnalyzer memory usage (same as in the User Settings dialog).

Best practices for memory management

Follow these best practices for managing and optimizing the QPR ProcessAnalyzer server memory usage:

  • Make sure that the total Estimated memory usage as displayed in the Models System Reports is less than the amount of memory available for the QPR ProcessAnalyzer server. The Estimated memory usage takes into account the estimated memory consumption needed for simultaneous user sessions, cached filters, calculation results, working memory and other on-time required computing resources. The actual memory consumption for each model immediately after it has been loaded into the memory is lower than the Estimated memory usage. Please make sure there is enough memory available after the models have been loaded so that the simultaneous usage does not result in running out of memory.
  • Model content can be optimized from the memory usage viewpoint. Usually, string type of data consumes most of the memory, and numbers, dates and booleans don't need that much memory. For strings, especially long texts and great number of unique texts consume lot of memory. Consider whether the information can be expressed using numbers, dates and booleans, and prefer them over strings.
  • Adjust the Drop Unused Filters After setting available for models (in the Model properties dialog) which determines the duration after which unused filter eventlogs are dropped from the memory. Lower values can be used when there isn't much memory available in the server. The Drop Unused Filters After setting is defined in format HH:mm:ss or d.HH:mm:ss, for example 01:00:00 (one hour), 00:30:00 (30 minutes) or 1.00:00:00 (24 hours). If this setting is not defined, the server level default setting is used. When any calculation is performed using a filter, the filter's last used time is updated.
  • Disable extending memory into disk (the page file), because it will slow down the system remarkably. Instead, make sure that there is enough memory in the system for workloads for QPR ProcessAnalyzer. (more information: https://docs.microsoft.com/en-us/windows/client-management/introduction-page-file)

Objects stored in memory

There are following types of in-memory objects that are managed by the QPR ProcessAnalyzer server:

Stored object Contents Unused objects dropped after Time to recreate Memory consumption
Models (model eventlogs) Models contain the eventlog data (events, cases), and objects calculated from the (e.g., event types, variations and flows). Models are never dropped automatically from the memory, even when there is a memory shortage in the server. To drop a model from memory, you need to drop the model in the Workspace. Note that if the server has been restarted, only models that have the automatic loading set are loaded into memory models directly after the restart. Slow

Models are loaded from the database requiring to transfer considerable amount of data, which takes much more time than e.g. calculating filters and analyses.

High
Filters (filter eventlogs) Filters contain all filtered data in model, which includes similar structures than the models. Primarily defined by the Drop Unused Filters After setting in the Model settings dialog. If this not set for a model, the server level DropUnusedFiltersAfter setting is used. If the server setting is not defined, a default value of 1 hour is used.

When the is a memory shortage in the server, they may be dropped from the memory earlier to free memory.

Fast

Filters are calculated from the model data that already exists in the memory. Practically, filters are subsets of models.

Medium
Calculation results Results of the calculations made in dashboards. Unused calculation results are kept 30 minutes in the memory. When the is a memory shortage in the server, they may be dropped from the memory earlier to free memory. Fast

Analysis results are calculated from filters, which already exist in memory.

Low
Datatables Contents of datatables. There is a fixed duration of 1 hour. When the is a memory shortage in the server, they may be dropped from the memory earlier to free memory. Depends on how much there is data in the datatable. Depends on how much there is data in the datatable.