In WSO2 products based on Carbon 4.4.0 or later versions, you have the option of setting the required tenant loading policy by enabling either Lazy Loading or Eager Loading of tenants. Additionally, you can separately control the loading policy for web applications and axis2 services deployed in your tenants using the GhostDeployment setting.
...
- Lazy Loading: Lazy loading of tenants ensures that all tenants are not loaded at the time the server starts. Instead, the tenants are loaded on demand (upon a request sent to a particular tenant). When a tenant receives a request, the particular tenant and all tenant-specific artifacts, except web applications and axis2 services , get loaded. Therefore, if you have these artifacts (web applications and axis2 services) deployed in your tenants, you will need to separately enable lazy loading for artifacts using the
GhostDeployment
setting. If lazy loading is not enabled for artifacts, by default, these artifacts will comply with the Eager loading behavior that is explained below.
Tenants (including the tenant-specific artifacts) are unloaded from memory , if the tenant remains idle for a specified amount of time. You can configure the allowed tenant idle time. See Configuring Lazy Loading for instructions. - Eager Loading: Unlike lazy loading, eager loading ensures that tenants will be initialized when the server starts (without any delays). You can switch to eager loading if required. Note that you also have the option of enabling eager loading for specific tenants so that only the required tenants will be loaded when the server starts. If you have web applications and axis2 services deployed for your tenants, you will want these artifacts to behave according to the eager loading policy. Therefore, it is recommended that you disable lazy loading for artifacts (
GhostDeployment
setting) when eager loading is enabled.
When eager loading is enabled, tenants (and the tenant-specific artifacts) are expected to remain in memory without unloading until the server shuts down. However, due to a known issue in the system, tenants (and the tenant-specific artifacts) will unload from the system if the tenants are idle for more than 30 minutes. You can overcome this condition by applying a system property to change the allowed tenant idle time. See Configuring Eager Loading for instructions.
...
Configuring the tenant unloading time (for Lazy Loading)
If you have Lazy loading enabled, you can configure the allowed tenant idle time. For example, if you set the idle time to 30 minutes, tenants that are idle for more than 30 minutes will be unloaded automatically in your system. You can configure this value using two methods.
...