Question
· Oct 11, 2022

How to purge these inactive license units?

According to the IRIS documentation, once a user id is identified, at lease one license will remain (forever if I understand it correcly). The documentation says "even if the number of processes under the user ID drops back under the maximum, InterSystems IRIS continues to allocate one license unit per process for that user ID. Only when all connections by the user ID are closed and there are no more processes under the user ID does license allocation reset to one unit for that user ID."

Our organization has a lot of IP addresses. We used to connect to Cache instances directly, resulting in a lot of User Ids and license units, and recently we used a firewall/reverse proxy. So license units for the User Ids made of these individual IPs are mostly not used anymore. Is there a way to purge them?

 

Many thanks

Discussion (4)2
Log in or sign up to continue

The section you refer too describes the behaviour if a client connects more than 25 times (= 'the maximum' in your text) :
When a client starts with e.g. 3 connections, it counts for 1 license.
When the client keeps adding more connection from the same ip, it will remain taking only 1 license, until it reaches 25 connections, at that time, it will count for 25 licences.
When the client keeps adding connections (e.g. 30 in total), the licence count add also up to 30 for this client.
When the client count drops below 25 again (e.g. 10), the licence count keeps counting all these connections as a separate license (so the client will still occupy 10 licences)
Even if the license count drops to 1, and goes up again to e.g. 5, the client will take 5 licenses.
Only when the client logs out completely, the counting of licenses will revert back to the inital behaviour where all connections below 25 only count for 1 license.
So you do not have to purge licenses : they will go away automatically when the client disconnects (except for csp pages where there is a 'grace' period which still holds the license for a number of minutes)
You just have to make sure your client count does not reach 25, or the client should disconnect when this happens to prevent a high license count.

Danny

You did not say why the user log out does not clear the licence slot use. I found this problem when using CSP Pages. Once evoked the licence stands and holds throughout the Grace period. hence a denial of service!!

so my question was: how can I control the Logout or migration away from my server, without leaving the licence active.

My Solution that solved ALL my problems was to add a Frame to hold the csp pages.

<body onBeforeUnload="Terminate();" onload="setpage();" >
<div  >
  
    <iframe name="topleft" id="topleft" src='#(..EscapeHTML(..Link("rCompanyStaffWelcome.csp","",1)))#
     style="position: absolute; overflow: hidden;"
     frameborder="0" scrolling="yes" width="#(LeftSize)#height='850px' align="left">
    </iframe>     </div>
    
 <div   >
  <iframe name="topright" id=topright src='#(..EscapeHTML(..Link("RightPage.csp","",1)))#
  frameborder="0" scrolling="yes" width="#(RightSize)#align="right">
    </iframe>
</div>  
 
</body>
</div>  
 

The Trick is in the :

<body onBeforeUnload="Terminate();"

<script language="JavaScript">
<!--
function Terminate() {
 tmp=#server(..Remove())#;
  }

<script arguments="" language=Cache Method="Remove" >
$G(%session.Data(0,"User"))="" 1
set z=##class(abc.system.objUserHistory).Logout(),%session.AppTimeout=3
quit 1
</script>

All my Csp pages create at least on single frame. -- onBeforeUnload -- forces the session to a 3 second timeout. long enough for the web session to die without generationg an error message.

In my case I am messuring the time of the session, so I need to Logout to complete the record. The User tag will always exist if the user has a licence. if not the livence has already been released.

Also My Timeout code within the web page is 5 seconds short of the Users inactive allowance. Thus the paage will logiout on its own accord.

Notice the single frame stands thougout the life of all the application webpages - all 3000 of them. One line of code in one place controlls everything. You cannot close the browser, navigate away or timeout without a Termination().

If the applications you're providing to users are REST/web/browser-based, you can make use of connection/process pooling, eg via an implementation in another back-end language, to avoid/minimise these issues.  A good example is the Node.js/JavaScript-based QEWD framework or its recent evolution  - qoper8-fastify - I've described the latter in another recent posting here on Node.js. 

Another alternative is to use our mg_web interface (you may want to check out our mgweb-server framework which packages up mg_web for ObjectScript-based REST APIs to save you a lot of effort): this uses modern web servers (eg Apache/NGINX) to manage connections to IRIS in a parsimonious way.

Some holiday reading:

QEWD: https://github.com/robtweed/qewd

QOper8-Fastify: https://github.com/robtweed/qoper8-fastify

Using QOper8-Fastify with IRIS: https://github.com/robtweed/qoper8-fastify/blob/master/IRIS.md

mg_web: https://github.com/chrisemunt/mg_web

mgweb-server: https://github.com/robtweed/mgweb-server

Take a look at our other language interfaces and front and back-end solutions too -  see https://www.mgateway.com