Pesquisar

Artigo
· Mar. 25, 2024 7min de leitura

A Peek at IRIS Data Platform Performance Strategies

In the business world, every second counts, and having high-performing applications is essential for streamlining our business processes. We understand the significance of crafting efficient algorithms, measurable through the big O notation.

Nevertheless, there are numerous strategies to boost the performance of systems built on the IRIS Data Platform. These strategies are equally crucial for optimizing overall efficiency.

Let's join the journey for a sneak peek into the tips for making IRIS Data Platform work better, where every little trick will help your applications shine.

1. Using Indexes

Indexing serves as a means to optimize queries by maintaining an organized subset of frequently requested data. Within the IRIS Data Platform, various index types cater to specific needs:

Standard Indexes: These are persistent arrays associating indexed values with the RowID(s) of the corresponding rows.

Example:

Index NameIDX ON Name;

Bitmap Indexes: A unique index type utilizing bitstrings to represent sets of RowID values corresponding to a given indexed value.

Example:

Index RegionIDX ON Region [Type = bitmap];

Bitslice Indexes: This special index allows rapid evaluation of specific expressions, such as sums and range conditions.

Example:

Index SalaryIDX ON Salary [Type = bitslice];

Columnar Indexes: Specifically designed for very fast queries, especially those involving filtering and aggregation operations, on columns with data stored across rows.

Example:

Index AmountIDX ON Amount [Type = columnar];

2. Query Plan

We want to ensure that our queries utilize defined indexes. However, sometimes they do not get executed as expected. For instance, if 'ColumnName IS NOT NULL' is used in the query's WHERE clause, even if an index is defined against ColumnName, it will skip the index. Therefore, it is not recommended to use 'ColumnName IS NOT NULL' if ColumnName has its index defined.  How can we determine if the query uses the index map or not? The Query Plan is the tool we can use to check if the query utilizes the index map or simply traverses the entire master map.

How to use query plan?

Run Show Plan either with the SQL EXPLAIN command or the Show Plan option in the Management Portal ->System Explore->SQL, then follow to the first map. If the first bullet item in the Query Plan is “Read master map”, or the Query Plan calls a module whose first bullet item is “Read master map”, the query first map is the master map rather than an index map. Because the master map reads the data itself, rather than an index to the data, this almost always indicates an inefficient Query Plan. Unless the table is relatively small, we should create an index so that when we rerun this query the Query Plan first map says “Read index map.”

3. Query Optimizer and Tune Table

When determining the optimal execution strategy for a given SQL query, the Query Optimizer takes into account three key factors:

  • ExtentSize: row count for each table used within the query.
  • Selectivity: the percentage of distinct values calculated for each column used by the query.
  • BlockCount: count for each SQL map used by the query.

These statistics can be specified in the persistent class storage definition.

To guarantee accurate decision-making by the Query Optimizer, it is crucial to set these values correctly.

  • We have the option to explicitly define any of these statistics when creating a class (table) before inserting data into the table.
  • Following the population of the table with representative data, we can utilize Tune Table to compute these statistics.
  • Subsequent to running Tune Table, we can replace a calculated statistic by specifying an explicit value.

We can assess the statistics we have explicitly defined against the results generated by Tune Table. If Tune Table's assumptions prove less than optimal for the Query Optimizer, choosing an explicitly set statistic over the one generated by Tune Table becomes a viable alternative.

What is Tune Table?

Tune Table is a utility designed to analyze the data within a table, providing insights into ExtentSize, the distribution of distinct values in each field, and the Average Field Size (average length of values in each field). Additionally, it computes the BlockCount for each SQL map. We have the option to instruct Tune Table to leverage this information for updating the metadata associated with a table and its fields. Subsequently, the query optimizer utilizes these statistics to determine the most efficient execution plan for a query.

It is recommended to run Tune Table on a table after populating it with a representative volume of actual data. Typically, running Tune Table once, as a final step in application development before the data goes live, is sufficient. In certain scenarios, IRIS automatically executes Tune Table the first time a SELECT query is performed on a table.

However, there are also manual ways to run Tune Table:

  • Using the Management Portal SQL interface Actions drop-down list.
  • Invoking the $SYSTEM.SQL.Stats.Table.GatherTableStats() Opens in a new tab method for a single table, or all tables in the current namespace.
  • Issuing the SQL command TUNE TABLE for a single table.

4. Columnar storage

In columnar storage, primary data is stored in one global per column. Sequences of 64,000 data elements are stored in separate global subscripts. Data is encoded using a vector encoding that is optimized for storing elements of the same data type. In general, analytical queries run quickly but transactions might be slower.

When shall we choose to use columnar storage to enhance the performance?

  • Filtering and aggregating data in specific columns to perform analytical queries (OLAP).
  • Data are not frequently updated, inserted, and deleted or data updated in bulk.

5. Avoiding frequently opening objects

Frequently opening objects can slow the application process down. Therefore, we should combine the opening of identical objects whenever possible and when it makes logical sense.

When we need to return an object property value, we can use ##(ClassName).PropertyGetStored(id). This built-in method is faster than using object.Property after opening an object by %OpenId().

6. Using Work Queue Manager

When there is a substantial process that needs to be completed, if certain parts of the process can run concurrently, it is advisable to consider a parallel processing system.

The Work Queue Manager allows us to enhance performance by programmatically distributing work to multiple concurrent processes.

How to use Work Queue Manager?

Set queue = $system.WorkMgr.Initialize("/multicompile=1",.status)
For i=1:1:100{
  Set status = queue.Queue("##class(ClassName).ClassMethod",i)
}
If status =1 Set status = queue.WaitForComplete()
If 'status {
  Do $system.Status.DisplayError(status)
}

7. Performance Monitoring Tools

There are a few of system monitoring tools available in the IRIS Data Platform. Here, we will take a quick look at ^%SYS.MONLBL and ^SystemPerformance.

^%SYS.MONLBL is a line-by-line monitor, providing a way to diagnose where time is spent executing selected code in routines. This utility allows us to monitor and identify which part of the code has a performance problem.

To start the monitor, use  

%SYS>Do ^%SYS.MONLBL

^SystemPerformance is a system snapshot tool for collecting detailed performance data about an IRIS Data Platform instance and the platform on which it is running. The resulting report can aid in diagnosing system problems and can be run in the terminal or in the Management Portal. By default, the output directory for the report is the install-dir\mgr directory of the IRIS instance.

To start the monitor, use  

%SYS>do ^SystemPerformance

To stop a running profile and abort the collected data, use

%SYS>do Stop^SystemPerformance(runid)

Alternatively, to stop the job without deleting log files and produce an HTML performance report from those log files, use

%SYS>do Stop^SystemPerformance(runid, 0)

8. Checking Performance by Counting Globals

We can utilize the following class method, which returns the number of global references made by a specified process: ##class(%SYSTEM.Process).GlobalReferences($JOB)

To achieve the performance monitoring purpose, we can run this class method at the beginning and the end of the process to check the amount of global accesses during this process being executed. The more globals being accessed, the slower the process would be.


Conclusion

As we conclude this journey, I hope you have found these insights valuable for enhancing your applications' performance. Feel free to implement these tips and witness the positive impact on your systems. For a deeper dive into these strategies and to uncover more valuable performance enhancement insights, explore our comprehensive online documentation. Thank you for joining on this exploration, and may your applications continue to thrive on the IRIS Data Platform.

 

More Performance Improvement Materials: (Thanks to @Vitaliy Serdtsev and @Benjamin De Boe )

10 Comments
Discussão (10)3
Entre ou crie uma conta para continuar
InterSystems Oficial
· Mar. 25, 2024

Update for Health Connect users

Are you using HealthShare® Health Connect? You should know that starting with version 2024.1, a private web server (PWS) will no longer be included in installations.

 


It is recommended that you migrate to an external production-grade web server to ensure security. Benefits include:

  • Only one web server is needed for all your instances.
  • You can take charge of security by keeping your web server up to date—no need to wait for the next InterSystems release.

See how to migrate to an external web server (video series, 10m).

Learn more in this FAQ post in the Developer Community.

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· Mar. 25, 2024

Suppression de fichier dans l'extensions Intersystems

Bonjour,

Je fais face a un problème assez embêtant,

Depuis un petit moment il ne m'est plus possible de supprimer des fichiers compilés et exportés dans Iris,

Normalement lorsque je vais dans l'extension InterSytems, j'ouvre mes classes dans mon namespace et lorsque je faisais clique droit > delete, les fichiers se supprimaient. Cependant, ce n'est plus le cas, lorsque je clique sur delete rien ne se passe

Quelqu'un saurait d'où vient le problème ?

Merci par avance

3 Comments
Discussão (3)2
Entre ou crie uma conta para continuar
Pergunta
· Mar. 25, 2024

Is the Implementation Partner program still open?

Anyone here know if the Implementation Partner program is still open, and if so, is there anyone we can contact to get more details? I've tried reaching out via the form on the website, I've called and left a message, and then I called and talked to someone a few weeks ago who said they would "forward my info over", but we still haven't heard back from anyone. We just want to get more info on what it entails, but can't seem to get in touch with anybody to talk about it. 

1 Comment
Discussão (1)2
Entre ou crie uma conta para continuar
Artigo
· Mar. 24, 2024 5min de leitura

Quickstart guide to IRIS DB on Linux Systems

Introduction

This is a quickstart guide to IRIS for Linux systems administrators who need to be able to support the IRIS DB as well as other normal infrastructure tasks.

IRIS is a DB system from Intersystems. An IRIS DB can hold code (in the form of a Class) or data (in the form of Globals). IRIS DB are Linux files called IRIS.DAT.

IRIS was previously called Cache. There may be some references to Cache in the Intersystems documentation or forums or in some of your system documentation.

IRIS classes are coded in language call ObjectScript. IRIS classes have properties and methods.

IRIS classes can be run as interactive jobs or as scheduled tasks all within IRIS.

 

IRIS code can be in terms of a procedure.

 

IRIS DBs are typically journalled in case transactions need to be rolled back or DBs need to be recovered from a backup via a rolled forward process.

 

IRIS DBs can be mirrored to provide a level of redundancy across 2 servers. If DBs are mirrored then the transaction updates must be committed to both mirror members before the application is advised that the update is successful. Intersystems terms the mirror members as “failover members”. One of the failover members is termed the PRIMARY and the other member is termed BACKUP.

 

There is also an arbiter node(server) so that there is a quorum. Quorum members “vote” as to which failover member has failed.

 

There can be a asynchronous mirror node. The asynchronous mirror node is updated on a store and forward basis from journals.

 

IRIS DB has a product called Ensemble that supports productions. There can be only one production per name space. Ensemble can be used to develop applications using a concept of Services (input queues), Processes (how to process the input queue) and Operations (output queue).

 

IRIS DB has a product called JReports for developing reports. The development of reports is intended to be like Crystal reports.

 

Interacting with IRIS

You can connect to IRIS with:

iris session <instance name>

 

You can find out how many instances there are defined on your system:

iris list

 

You can also connect to IRIS via the Management Portal which is GUI/web based.

 

There is also a command like interface called WebTerminal which is often installed.

 

IRIS is configured via a configuration/parameter file typically called iris.cpf.

The iris.cpf file will show the location of the IRIS.DAT file for each defined database. The iris.cpf file will also show the mirror configuration.

 

Namespace vs DB

DB files by convention live in a directory that has the name of the DB itself.

 

Namespace are a logical concept that stores data or code.

 

A namespace provides access to data and to code, which is stored (typically) in multiple databases. Databases (IRIS.DAT) are the physical manifestation of the namespace.

 

All InterSystems IRIS systems will have a namespace of “%SYS” and “USER”. There are other default namespaces:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GORIENT_enviro#GORIENT_enviro_namespace_system

 

Journalling

Journal records are written to journal files which are located on one of 2 directories/filesystems – a primary and secondary area. When the primary area is full then journals will be written to the  secondary area. When the secondary area is full then journals will be written to the  primary area.  When the primary area is full then journals will be written to the  secondary area….

Journal files are switched when backups start, backups finish, under operator control or when the configured journal size is exceeded.

When both journal areas are full then all transactions stop.

There is usually a scheduled task that deletes old journal based on the age (number of days prior to today) or the number of previous backups. The default is 2 days old or 2 backups completed. 

 

 

Objectscript

These are some basic commands:

DO <- run a class method or procedure that is stored in the namespace/database

SET <- assign a value to a variable. Variable can be set to a literal or output from a method or class property. Variables do not need to be declared.

KILL <- deletes a variable

WRITE <- write text or variable contents or combination

 

Variable names are case-sensitive.

 

If the variable name starts with a ^ then it is a global. Global are multi dimensional storage areas. Where the variable is a global (variable name starting with ^) this structure is written persistently to the namespace then to the database(s).

Intersystems documentation says:

In InterSystems IRIS, a database contains globals and nothing else; even code is stored in globals. At the lowest level, all access to data is done via direct global access — that is, by using commands and functions that work directly with globals.”

 

All other variables only exist in current user session.

 

If the name with DO  starts with a ^ then it is a procedure. For example

DO ^MIRROR

DO ^JOURNAL

 

ZN “%SYS” <- Change namespace

set status=##class(%SYS.Journal.System). GetState() <- Get the journal status

write $CASE(status,                                                          <- Print the journal status using a case statement

            0:"Enabled",1:"Disabled",2:"Suspended",

            3:"Frozen",4:"Paused")

 

List all namespaces

DO ##class(%SYS.Namespace).ListAll(.result)

zwrite result

1 Comment
Discussão (1)1
Entre ou crie uma conta para continuar