Load balancing

Dinamo has a load balancing mechanism, allowing for greater availability of the environment and performance for applications. It is possible to have up to 16 (sixteen) Dinamo units in a load balancing system, with the same number of sessions on each device. Load balancing is transparent to the application, i.e. once load balancing has been enabled in the environment, the application benefits from it without the need for any changes.

Balancing works on a round-robin basis, distributing connections circularly between the HSMs configured for balancing. The balancing unit is the session with the HSM, regardless of the load or APIs used in each session and also the resource utilization rate in each HSM. The HSM that will establish the session with the application is defined by the balancing framework and not by the application. The balancing scheme works per process, i.e. within each process it is its sessions that will be balanced; if two processes run at the same time, each will have a separate and independent balancing structure.

If the application is using objects stored in the HSM, the object must exist in all the HSMs. It is recommended that an HSM is initially prepared with all the objects used by the application and a backup is generated from it, which will be restored in all the other HSMs that are part of the balancing set.

Info

Balancing cannot be used by applications that create objects within a session, need to persist these objects between sessions but do not use the HSM's replication mechanism, because in this case the creation of the object is not replicated between the HSMs and there is no guarantee that the next session will be directed to the HSM where the object was created. For applications that create objects that must persist between sessions, and the HSM replication mechanism is not used, it is up to the application to maintain a synchronization mechanism between the bases of the HSMs participating in the balancing. This mechanism can be based on exporting and importing objects, for example.

Load balancing and session caching are enabled via environment variables. If the environment variable definition is system wide, all applications benefit from the balancing and/or caching structure (because the processes inherit the environment variable definitions from the system). It is also possible to make a configuration by setting the environment variable only for the particular process of an application. Consult the operating system documentation for details on creating and scoping environment variables.

Load balancing has the following characteristics:

  1. Intra-process: load balancing is done per process. This means that 2 applications on the same machine will have different balancing sets;
  2. Centralized: implemented in the HSM library. This way balancing is enabled at a central point and all other libraries dependent on it inherit the functionality
  3. Transparent: to enable balancing you just need to enable an environment variable. No changes to the application's source code are required