Pesquisar

Artigo
· Fev. 19 4min de leitura

Keeping IRISTEMP Under Control: Stop It from Taking Over Your Storage!

 

So, you checked your server and saw that IRISTEMP is growing too much. There's no need to panic. Let’s investigate the issue before your storage runs out.

Step 1: Confirm the IRISTEMP Growth Issue

Before assuming IRISTEMP is the problem, let’s check its actual size.

Check the Free Space

Run the following command in the IRIS terminal:

%SYS>do ^%FREECNT

When prompted, enter:

Database directory to show free space for (*=All)? /<your_iris_directory>/mgr/iristemp/

If the output shows very low free space, IRISTEMP is filling up your storage like an overstuffed closet. But if the free space is fine, yet the IRISTEMP database file (IRIS.DAT) is still massive (which is probably why you're here), it means the temporary data has already been cleaned up. In that case, your mission is to keep an eye on things, follow the steps below to catch it in the act next time, and recover that precious space. 

Step 2: Identify What is Using IRISTEMP

Run ^%GSIZE to Find Large Globals

%SYS>do ^%GSIZE

Follow the prompts:

Directory name: /<your_iris_dir>/mgr/iristemp/

All Globals? No => yes

33 items selected from
33 available globals

1) Get exact packing details
2) Get block counts only
3) Use fast stochastic estimate

Please select an option:  3 => 3

Example output:

        Global              Blocks          Bytes Used Packing
      ----------- ---------------- ------------------- -------
      IRIS.Temp.Ensemble
                                1                  60      1 %
      IRIS.Temp.MARIO
                               50             360,960     88 %
      IRIS.Temp.RecompileInfo
                                1                  84      1 %

If you see something unfamiliar, especially related to ISC or SQL, it could be SQL queries using too much space. Check with the application developers to see what these queries are doing and whether they can be optimized. Sometimes, adding an index or removing an unnecessary ORDER BY clause can make a big difference. 

Step 3: Check Process-Private Globals (PPGs)

Process-Private Globals (PPGs) may not be released properly by some processes. Run:

%SYS>DO ^GETPPGINFO

Example output:

%SYS> DO ^GETPPGINFO("*")
Process ID: 303 --> Total PPG Block count 10840
  ^||%t uses 10838 blocks (maxblock #1926355)
  ^||TempQuery uses 2 blocks (maxblock #115489)
  Highest block #: 1926355
Process ID: 33456 --> Total PPG Block count 45343
  ^||MARIOtest uses 45343 blocks (maxblock #1927313)
  Highest block #: 1927313

If a process is using a lot of PPG space, it might be stuck or not working as expected. You should investigate with the application developers to find if the PPGs are known and there is something broken in the code. The same, if the PPG is not known at old and looks like InterSystems internal code (for example ^||%t) is better you open a WRC support case asking for help. 

Become an expert in GETPPGINFO by reading the official documentation.

Step 4: Fix the Problem

Option 1: Stop the Process 

Once you have identify the process consuming the IRISTEMP, if you know what is doing and consider it safe, you can use either the System Management Portal or the terminal for killing it. From the terminal, you can find the job and terminate it:

%SYS>do ^JOBEXAM

Find the job number and run:

%SYS>DO ^RESJOB
 
Force a process to quit InterSystems IRIS
 
Process ID (? for status report): 7732

Process ID (? for status report):
 
%SYS>

⚠️ Only stop a process if you know it and you are sure it is safe to do so!

Option 2: Restart IRISTEMP and Set Limits

To clear IRISTEMP, stop Iris, remove its IRIS.DAT file and restart:

iris stop <instance_name>
rm /<iris_directory>/mgr/iristemp/IRIS.DAT
iris start <instance_name>

To reset IRISTEMP at startup and return space to the OS, set a limit in your IRIS configuration with:

[Startup]
MaxIRISTempSizeAtStart=5000

See the official documentation on  MaxIRISTempSizeAtStart for more details. Without this, IRISTemp will empty but keep its bloated size! For better control, consider relocating IRISTEMP to a dedicated volume or setting a max DB size in SMP. Also, there are other articles with more details in the community: How to Shrink IRISTEMP 

Option 3: Old version? Upgrade!

If you are running an old Iris version, upgrade! For example, I do remember we fixed a bug in 2021.1.1+ where the IrisTemp could grow uncontrollably. Upgrading and being on the latest maintenance releases is the best way to be hit by known bugs.

Conclusion: Keep IRISTEMP Under Control

By following these steps, you can:

✅ Find what is using IRISTEMP with ^%GSIZE and ^GETPPGINFO
✅ Stop known processes that hold too much PPG space
✅ Recover the space by setting limits or recreating the IrisTemp database.

Upgrade! This is always recommended! 

By doing this, you can keep IRISTEMP under control and avoid storage issues. 🚀

4 Comments
Discussão (4)2
Entre ou crie uma conta para continuar
Artigo
· Fev. 19 19min de leitura

Securing HL7 Interfaces with SSL/TLS (X.509) Certificates

What is TLS?

TLS, the successor to SSL, stands for Transport Layer Security and provides security (i.e. encryption and authentication) over a TCP/IP connection. If you have ever noticed the "s" on "https" URLs, you have recognized an HTTP connection "secured" by SSL/TLS. In the past, only login/authorization pages on the web would use TLS, but in today's hostile internet environment, best practice indicates that we should secure all connections with TLS.

1 Comment
Discussão (1)2
Entre ou crie uma conta para continuar
Anúncio
· Fev. 19

[懸賞] DC 検索の改善にご協力お願いします!(抽選で 1 名の方に素敵な賞品プレゼント)- USコミュニティ

開発者の皆さん、こんにちは!

前回の懸賞 が大好評でしたので、今回も開催することにいたしました!😉 今回の懸賞のテーマは 

🔎 DC 検索 🔍

検索エンジンを改善する方法についていくつかご提案がございましたらぜひお聞かせください。

検索を改善する方法についてのアイデアを共有いただいた開発者コミュニティのメンバーをランダムに選び、素敵な賞品を差し上げます!

この懸賞に参加するための要件は以下の通りです。

  • コミュニティのメンバーになる (InterSystems の従業員の参加できます!)
  • 検索の改善に関するアイデア を InterSystems Ideas Portal に登録してください。登録時、カテゴリ:Community を選択し改善したい点とその方法について可能な限り詳しく説明してください。
  • 他の人に知ってもらえるように、USコミュニティ記事のコメント欄にあなたが投稿されたアイデアのリンクとお名前をシェアしてください。

3 月中旬に Ideas Portal  へガイドラインに沿ってアイデアを投稿いただいた方全員の中から random.org を使用して 1 名を選出します!見事当選された方には、かわいいギフトが贈られる予定です。

皆さん、頑張ってください!☘


注意:

  • 重複したアイデアは受け入れられません。提出するアイデアが独自のものであることを確認してください。 
  • 当社はアイデアを管理する権利を留保します。モデレーターの決定は最終的なものとなります。
  • アイデアを提出する方法についての簡単なガイドを以下に示します。
  • 投稿するアイデアが多ければ多いほど、賞品を獲得できる可能性が高くなります 🤗
Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· Fev. 18 2min de leitura

第二十八章 T 开头的术语

第二十八章 T 开头的术语

以 T 开头的术语

表 (table)

InterSystems SQL

表是一种由表示特定实体的行和表示每个实体特定数据点的列组成的数据结构。

目标角色 (target role)

系统

在受保护的 IRIS 应用中,由应用程序授予给已经是其他角色(称为匹配角色)成员的用户的角色。如果用户拥有匹配角色,则在使用应用程序时,用户还可以被授予一个或多个额外的目标角色。

目标用户 (target user)

系统

Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· Fev. 18 34min de leitura

API REST com Swagger no InterSystems IRIS

API REST com Swagger no InterSystems IRIS

 

Olá,

O protocolo HTTP permite a obtenção de recursos, como documentos HTML. É a base de qualquer troca de dados na Web e um protocolo cliente-servidor, o que significa que as requisições são iniciadas pelo destinatário, geralmente um navegador da Web.

As API REST se beneficiam deste protocolo para trocar mensagens entre cliente e servidor. Isso torna as APIs REST rápidas, leves e flexíveis. As API REST utilizam os verbos HTTP GET, POST, PUT, DELETE e outros para indicar as ações que desejam realizar.

Quando realizamos uma chamada a uma API RESt na verdade o que ocorre é uma chamada HTTP. A API recebe esta chamada e de acordo com o verbo e o caminho solicitados a API executa a ação desejada. No caso da implementação em Iris podemos ver isso claramente na área de definição da URLMap:

XData UrlMap
{
<Routes>
        <Route Url="/cliente" Method="POST" Call="Incluir"  Cors="true"/>
        <Route Url="/cliente/:chave" Method="PUT" Call="Alterar"  Cors="true"/>
        <Route Url="/cliente/:chave" Method="DELETE" Call="Deletar"  Cors="true"/>
        <Route Url="/cliente/:chave" Method="GET" Call="Pesquisar"  Cors="true"/>
        <Route Url="/cliente" Method="GET" Call="Listar"  Cors="true"/>
    </Routes>
}

Veja que temos o caminho (Url) e o verbo (Method) definido para cada chamada (Call). Assim o código que atende a API sabe o que deve realizar.

Essa estrutura na API REST não atende somente ao roteamento das ações que chegam para a API.

Ela também é a base para a criação do arquivo de Swagger da API, conforme vemos na documentação da classe %REST.API, método GetWebRESTApplication: https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....

Vamos ver como podemos gerar essa documentação então.

Primeiro vamos publicar nossa API. Vamos utilizar a mesma API do artigo https://community.intersystems.com/post/using-rest-api-flask-and-iam-intersystems-iris-part-1-rest-api

Basta então seguir as orientações e utilizar o código que o artigo disponibiliza para termos nossa API publicada.

Uma vez publicada a API vamos incluir uma nova rota no URLMap e um novo método no nosso código:

 

        <Route Url="/openapi" Method="GET" Call="OpenAPI" Cors="true"/>

ClassMethod OpenAPI() As %Status
{
    Do ##class(%REST.Impl).%SetContentType("application/json")
    
    Set sc = ##class(%REST.API).GetWebRESTApplication("", "/rest/servico", .swagger)
    
    If $$$ISERR(sc) {
        Quit sc  // If an error occurred, exit the method
    }

        
    Write swagger.%ToJSON()

    Quit $$$OK
}

 

Inclua no código da API a nova rota e o método associado a ela. Vamos agora fazer um teste. Vamos abrir o Postman e chamar o endpoint referente a geração do Swagger, que é o /openapi:

 

E a seguir temos a definição completa do Swagger gerado pela nossa chamada:

{

    "info": {

        "title": "",

        "description": "",

        "version": "",

        "x-ISC_Namespace": "DEMO"

    },

    "basePath": "/rest/servico",

    "paths": {

        "/cliente": {

            "post": {

                "parameters": [

                    {

                        "name": "payloadBody",

                        "in": "body",

                        "description": "Request body contents",

                        "required": false,

                        "schema": {

                            "type": "string"

                        }

                    }

                ],

                "operationId": "Incluir",

                "x-ISC_ServiceMethod": "Incluir",

                "x-ISC_CORS": true,

                "responses": {

                    "default": {

                        "description": "(Unexpected Error)"

                    },

                    "200": {

                        "description": "(Expected Result)"

                    }

                }

            },

            "get": {

                "operationId": "Listar",

                "x-ISC_ServiceMethod": "Listar",

                "x-ISC_CORS": true,

                "responses": {

                    "default": {

                        "description": "(Unexpected Error)"

                    },

                    "200": {

                        "description": "(Expected Result)"

                    }

                }

            }

        },

        "/cliente/{chave}": {

            "put": {

                "parameters": [

                    {

                        "name": "chave",

                        "in": "path",

                        "required": true,

                        "type": "string"

                    },

                    {

                        "name": "payloadBody",

                        "in": "body",

                        "description": "Request body contents",

                        "required": false,

                        "schema": {

                            "type": "string"

                        }

                    }

                ],

                "operationId": "Alterar",

                "x-ISC_ServiceMethod": "Alterar",

                "x-ISC_CORS": true,

                "responses": {

                    "default": {

                        "description": "(Unexpected Error)"

                    },

                    "200": {

                        "description": "(Expected Result)"

                    }

                }

            },

            "delete": {

                "parameters": [

                    {

                        "name": "chave",

                        "in": "path",

                        "required": true,

                        "type": "string"

                    }

                ],

                "operationId": "Deletar",

                "x-ISC_ServiceMethod": "Deletar",

                "x-ISC_CORS": true,

                "responses": {

                    "default": {

                        "description": "(Unexpected Error)"

                    },

                    "200": {

                        "description": "(Expected Result)"

                    }

                }

            },

            "get": {

                "parameters": [

                    {

                        "name": "chave",

                        "in": "path",

                        "required": true,

                        "type": "string"

                    }

                ],

                "operationId": "Pesquisar",

                "x-ISC_ServiceMethod": "Pesquisar",

                "x-ISC_CORS": true,

                "responses": {

                    "default": {

                        "description": "(Unexpected Error)"

                    },

                    "200": {

                        "description": "(Expected Result)"

                    }

                }

            }

        },

        "/openapi": {

            "get": {

                "operationId": "OpenAPI",

                "x-ISC_ServiceMethod": "OpenAPI",

                "x-ISC_CORS": true,

                "responses": {

                    "default": {

                        "description": "(Unexpected Error)"

                    },

                    "200": {

                        "description": "(Expected Result)"

                    }

                }

            }

        },

        "/test": {

            "get": {

                "operationId": "Test",

                "x-ISC_ServiceMethod": "Test",

                "x-ISC_CORS": true,

                "responses": {

                    "default": {

                        "description": "(Unexpected Error)"

                    },

                    "200": {

                        "description": "(Expected Result)"

                    }

                }

            }

        }

    },

    "swagger": "2.0"

}

 

O link a seguir nos dá acesso a documentação do Iris que aponta uma ferramenta que recebe a saída da nossa chamada de API e transforma em uma interface amigável de documentação e testes do serviço: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

Vamos acionar esta URL e informar o caminho para recuperar a definição Swagger da nossa API: https://swagger.io/tools/swagger-ui/

Vamos substituir a chamada de demo da páguma (a chamada petstore) pela nossa chamada: http://127.0.0.1/iris_iss/rest/servico/openapi e veja a tela com a documentação Swagger gerada:

No alto da chamada temos as informações básicas da nossa API:

E podemos ainda navegar pelas chamadas e visualizar informações importantes, como na chamada POST para incluir um novo cliente:

Mas, como vimos um pouco acima, a definição Swagger é na verdade um arquivo no formato JSON que fica disponível para nós na forma de um %DynamicObject (ver documentação em https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....) após a chamada ##class(%REST.API).GetWebRESTApplication que realizamos no nosso método OpenAPI. Desta forma, baseados na definição OpenAPI 2.0 podemos incluir ou remover informações do nosso Swagger. Vamos, por exemplo, enriquecer as informações básicas da API. Segundo a definição da Versão 2.0 (https://swagger.io/specification/v2/ ) podemos ter as seguintes informações disponibilizadas:

 

Vamos então completar as informações que podemos disponibilizar. Para isso vamos alterar nosso método OpenAPI, incluindo as informações básicas, protocolo aceito, autenticação e dados de acesso (host e basePath):

ClassMethod OpenAPI() As %Status
{
              Do ##class(%REST.Impl).%SetContentType("application/json")
    
    Set sc = ##class(%REST.API).GetWebRESTApplication("", "/rest/servico", .swagger)
    
    If $$$ISERR(sc) {
        Quit sc  // If an error occurred, exit the method
    }

 


              Do ##class(%REST.Impl).%SetContentType("application/json")
    
    Set sc = ##class(%REST.API).GetWebRESTApplication("", "/rest/servico", .swagger)
    
    If $$$ISERR(sc) {
        Quit sc  // If an error occurred, exit the method
    }
    
    Set info = {
        "title": "Cliente",
        "description": "API de Manipulação de Cliente",
        "version": "1.00"
    }

   Do swagger.%Set("info", info)

 

   Do swagger.%Set("host", "127.0.0.1")
   Do swagger.%Set("basePath", "/iris_iss/rest/servico")

 

   Set schemes = []
   Do schemes.%Push("http")

   Do swagger.%Set("schemes", schemes)
             
   Set security = [{"basicAuth":[]}]

   Do swagger.%Set("security", security)


   Set securityDefinitions = {}
   Do securityDefinitions.%Set("basicAuth", {})
   Do securityDefinitions.basicAuth.%Set("type", "basic")   

   Do swagger.%Set("securityDefinitions", securityDefinitions)  

 
    Write swagger.%ToJSON()

    Quit $$$OK
}


Chamando novamente a documentação Swagger na página de visualização agora temos a seguinte saída:

 

Veja que a nossa documentação está bem mais completa, com as informações sobre a API mais detalhadas, como por exemplo, o mecanismo de autenticação (Basic Auth), o protocolo aceito (HTTP) e as definições de versão, descrição e URL.

Podemos agora enriquecer a definição das chamadas, colocando a estrutura esperada nos payloads e exemplos de dados para a chamada. Para isso vamos sobrepor a informação em paths para “/cliente”:

ClassMethod OpenAPI() As %Status
{
              Do ##class(%REST.Impl).%SetContentType("application/json")
    
    Set sc = ##class(%REST.API).GetWebRESTApplication("", "/rest/servico", .swagger)
    
    If $$$ISERR(sc) {
        Quit sc  // If an error occurred, exit the method
    }


              Do ##class(%REST.Impl).%SetContentType("application/json")
    
    Set sc = ##class(%REST.API).GetWebRESTApplication("", "/rest/servico", .swagger)
    
    If $$$ISERR(sc) {
        Quit sc  // If an error occurred, exit the method
    }
    
    Set info = {
        "title": "Cliente",
        "description": "API de Manipulação de Cliente",
        "version": "1.00"
    }
    Do swagger.%Set("info", info)

 

    Do swagger.%Set("host", "127.0.0.1")
    Do swagger.%Set("basePath", "/iris_iss/rest/servico")

    Set schemes = []
    Do schemes.%Push("http")
    Do swagger.%Set("schemes", schemes)
             
    Set security = [{"basicAuth":[]}]
    Do swagger.%Set("security", security)

    Set securityDefinitions = {}
    Do securityDefinitions.%Set("basicAuth", {})
    Do securityDefinitions.basicAuth.%Set("type", "basic")
    Do swagger.%Set("securityDefinitions", securityDefinitions)
   
    Set incluirPesquisar = {
        "post": {
            "summary": "Criar um novo cliente",
            "description": "Recebe os dados de um cliente e cadastra no sistema.",
            "parameters": [
                {
                    "name": "body",
                    "in": "body",
                    "required": true,
                    "schema": {
                        "type": "object",
                        "properties": {
                            "nome": {
                                "type": "string",
                                "description": "Nome do cliente"
                            },
                            "idade": {
                                "type": "integer",
                                "description": "Idade do cliente"
                            }
                        },                              
                        "required": ["nome", "idade"],
                                           "example": {
                                                          "nome": "João Silva",
                                                          "idade": 30
                                           }
                    }
                }
            ],
            "responses": {
                          "default": {
                    "description": "Falha na chamada da API"
                },
                "200": {
                    "description": "Cliente criado com sucesso"
                },
                "406": {
                    "description": "Falha na inclusão do cliente"
                }                
            }
                            },
              "get": {
                    "summary": "Recupera todos os clientes",
                    "description": "Retorna a lista de clientes com suas informações.",
                    "responses": {
                                  "default": {
                    "description": "Falha na chamada da API"
                },
                      "200": {
                        "description": "Lista de clientes",
                        "schema": {
                          "type": "object",
                          "properties": {
                            "clientes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "chave": {
                                    "type": "string",
                                    "description": "Chave única do cliente"
                                  },
                                  "nome": {
                                    "type": "string",
                                    "description": "Nome do cliente"
                                  },
                                  "idade": {
                                    "type": "integer",
                                    "description": "Idade do cliente"
                                  }
                                },
                                "required": ["chave", "nome", "idade"]
                              }
                            }
                          },
                          "example": {
                            "clientes": [
                              {
                                "chave": "1",
                                "nome": "Maria",
                                "idade": 35
                              },
                              {
                                "chave": "2",
                                "nome": "Julio",
                                "idade": 57
                              },
                              {
                                "chave": "4",
                                "nome": "Julia",
                                "idade": 25
                              },
                              {
                                "chave": "5",
                                "nome": "Julia",
                                "idade": 22
                              }
                            ]
                          }
                        }
                      }
                    }      
                            }            
      }
    Do swagger.paths.%Set("/cliente", incluirPesquisar)
   
 
    Write swagger.%ToJSON()

    Quit $$$OK
}

 

 

Chamando novamente a documentação podemos visualizar agora os métodos POST para incluir um cliente e GET para recuperar um cliente:

Veja que já temos uma explicação do que é cada um dos métodos disponíveis para o POST e o GET que sobrescrevemos.

Note também não temos mais as tags "x-ISC_ServiceMethod" e "x-ISC_Namespace" que não colocamos na nossa nova definição.

Clicando para expandir o método POST por exemplo, agora temos visualmente um exemplo de chamada (Example Value):

E o formato do payload da chamada (Model):

Já na recuperação dos clientes, temos a definição do Response devolvido com exemplo:

E também com o modelo esperado como resposta:

 

Ainda, podemos testar as chamadas a API pela própria página de documentação. Veja o botão Try it out disponível na página. Clique nele, e a seguir em Execute e veja o resultado:

 

Estas possibilidades para a abordagem Code First de uma API REST nos abrem muitas possibilidades de documentação, permitindo controlar o que será divulgado, adicionando ou subtraindo as informações que julgamos convenientes no material publicado. A definição OpenAPI é muito completa e detalhada. Existem diversas informações que podemos incluir ou retirar, dependendo do que precisamos ou desejamos disponibilizar nela.

Até a próxima!

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