Stayin’ Alive, Stayin’ Alive

Heartbeats play a vital role in software licensing

Heartbeats are messages sent from a licensed application to the license server while the application has one or more licenses checked out from the server. The license server acknowledges the receipt of each heartbeat by sending a message back to the application. In this way, each side can know that the other side is up, running, and healthy, or take appropriate action if the other side is not healthy.

Heartbeat messages ensure that the license server has an accurate count of the number of concurrent client licenses in use.

When to use Heartbeats

Not all licensed applications use heartbeats, and by default they don’t. The application developer must make specific RLM functions calls to make use of heartbeats. Typically short duty cycle applications – those that run only for a short period of time, like compilers – don’t use heartbeats. It would be pointless to use heartbeats in an application whose duty cycle is on the order of a couple of minutes or less.

Note that if a licensed application (client) crashes or exits without checking in its licenses, the license server detects this and returns any licenses used by the crashed or exited application to the pool of available licenses. However, if the client operating system crashes or the network between them is segmented, the server is unaware of this and the client’s licenses remain checked out until the server times the licenses out or human intervention is taken.

The ISV server keeps track of how long it has been since it has received a heartbeat from each client. The end user can set up a TIMEOUT (per product) or TIMEOUTALL (all products) in the ISV options file. For each client with a license checked out, if the server hasn’t received a heartbeat within the specified interval, it decides that the client is no longer active, and returns its license(s) to the available pool. By default the ISV server doesn’t have any timeout. The ISV may specify on a per-license basis the minimum timeout that may be specified iby the end user. This is done with the “min_timeout=n” optional license attribute.

If a TIMEOUT interval is set too low and an active client’s license is returned to the available pool, an appropriately-coded client will attempt to reacquire the license without interruption of service.

Using Heartbeats in the Client

The licensed application developer has the choice between using automatic heartbeats, manual heartbeats, or no heartbeats at all (the default). With automatic heartbeats, RLM creates a thread to perform the sending of heartbeats and tracking of responses. With manual heartbeats, the client calls an RLM function periodically which checks for the acknowledgment of the previous heartbeat and sends another one. Automatic heartbeats are a good choice where the application can afford for RLM to create a thread. Where the application needs all available threads for itself, manual heartbeats are the logical choice.

Leave a Reply

Your email address will not be published. Required fields are marked *