Skip to content

Recycle Agents Manually

Cause

MS-Agents use Session Memory and Overhead Memory. Session memory is allocated for ABL sessions spawned by the agent. Overhead Memory is the memory that the agent uses for overhead, to manage sessions and route requests, etc.

The memory is allocated to the ABL session. Some memory is shared with other sessions (parts of database connection information, shared procedure libraries and a few other things). When a request comes in, a thread is assigned to the memory for the session, and the .p code is run within the context of that session. When the request completes, the memory (in state-free) is left more or less as-is, and the thread is freed back into the pool for further use by the next request that needs it. If a session isn't bound to a thread, then nothing is happening with that session.

Be aware that memory freed by an application, may still reside within the memory allocated to that app by the OS. The OS may not immediately reclaim the memory. The OS itself has heuristics based on memory pressure for when the memory is actually reclaimed for use by other processes. Each OS is a bit different in how this is handled. That is to say, terminating a session won't necessarily make the memory for the agent process shrink immediately (or at all).

Once ABL session is terminated - instead of releasing the memory to the OS and asking again every time, the agent holds the memory and use it for the next requests. To release that memory to OS recycle of MS-Agents can be done.

Resolution

This is intended to work with a PAS instance configured with maxAgents >= 2. Recommendation is to have a min/initial number of 2 agents, with enough sessions/connections configured to handle typical workload on one agent, so that a “spare” is always available to begin taking requests. After stopping the agent, traffic that was originally handled by the lead agent (to stop and recycle) requests are handled by the next agent available to the PAS instance. The minAgents = 2 will assure the agent is started and available.

ProDiscoverer tools use oemanager REST APIs which gracefully stop MS-Agent (starting from OE 11.7.2) – i.e. MS-Agent completes all requests before stopping. Once the agent is terminated – only then the memory allocated to MS-Agent goes back to the OS (hint -the OS may not immediately reclaim the memory).

Recycle Agents manually

  1. If „spare“ MS-Agent is not already running – manually start it as a new MS-Agent by clicking on „Add Agent“ button.
  2. Select „old“ MS-Agent by clicking radio button next to its „AgentsId“ column in „Agents“ grid.
  3. Stop „old“ MS-Agent by clicking its menu option „Stop Agent“.
  4. Click on „Refresh Agents List“ button.
  5. After stopping the agent, traffic that was originally handled by the lead agent (to stop and recycle) requests are handled by the next agent available to the PAS instance, i.e. a „spare“ MS-Agent now is available to begin taking requests.