This documentation is for WSO2 Carbon 4.4.3. View documentation for the latest release.
Configuring the Tenant Loading Policy - Carbon 4.4.3 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

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. 

  • Lazy Loading: Lazy loading is a design pattern used specifically in cloud deployments to prolong the initialisation of an object until it is requested by a tenant or an internal process. Lazy loading of tenants is a feature that is built into all WSO2 products, which ensures that in an environment with multiple tenants, all tenants are not loaded at the time the server starts. Instead, they are loaded only when a request is made to a particular tenant. If a tenant is not utilised for a certain period of time, it will be unloaded from memory.
  • Eager Loading: Eager loading is a design pattern commonly used in computer programming. As opposed to lazy loading, eager loading initialises an object upon creation. If Eager loading is enabled in WSO2 products, existing tenants will be loaded without any delays when the Carbon server starts. You can also enable this feature for specific tenants, so that only the required tenants will be loaded when the server starts.

Lazy Loading is enabled as the tenant loading policy in WSO2 products by default. You can either configure the default setting (Lazy Loading) or replace it with Eager Loading as explained below. 

Note that at any given time, there can only be one configuration (Lazy Loading or Eager Loading) enabled.

Enabling Eager Loading

By default, Lazy Loading is enabled as the tenant loading policy. You can change this to Eager Loading as follows:

  1. Open the carbon.xml file from the <PRODUCT_HOME>/repository/conf/ directory. Enable the <EagerLoading> element and comment out <LazyLoading>.

  2. Enable the <EagerLoading> element and comment out <LazyLoading> as shown below. 

    <Tenant>
       		 <LoadingPolicy>
          	 <!--<LazyLoading>
               		 	<IdleTime>30</IdleTime>
           		 </LazyLoading>-->
           		 <EagerLoading>
               			<Include>*,!foo.com,!bar.com</Include>
           		 </EagerLoading>
      		</LoadingPolicy>
    </Tenant>
  3. You can then list the specific tenant domains to which Eager Loading should apply by using the <Include> element. See the following examples:
    • If the setting should apply to all tenants, add <Include>*</Include>.
    • If the setting should apply to all tenants, except foo.com and bar.com, add <Include>*,!foo.com,!bar.com</Include>.
    • If the setting should apply only to foo.com and bar.com, add <Include>foo.com,bar.com</Include>. 

Configuring the Lazy Loading idle time 

If you are using the default tenant loading policy (Lazy Loading), you have the option of setting the required 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. 

Follow the steps given below.

  1. Open the carbon.xml file. 

  2. Be sure that the <LazyLoading> element is enabled and <EagerLoading> is commented out as per the default setting.
  3. Set the tenant idle time using the <IdleTime> element as shown below.

    <Tenant>
       		 <LoadingPolicy>
          	     <LazyLoading>
               		 	<IdleTime>30</IdleTime>
           		 </LazyLoading>-->
           	 <!--<EagerLoading>
               			<Include>*,!foo.com,!bar.com</Include>
           		 </EagerLoading>-->
      		</LoadingPolicy>
    </Tenant>

Note that the loading policy configurations explained above only applies for tenants and not for artifacts. If required, you can enable Lazy Loading for artifacts by using the following code segment in the carbon.xml file. You cannot enable Eager Loading for artifacts.

<GhostDeployment>
   <Enabled>false</Enabled>
</GhostDeployment>

Lazy loading of artifacts is a feature that is used by some Carbon products. The deployer that handles lazy loading is called the GhostDeployer. By default, this is set to 'false' because the Ghost Deployer works only with the HTTP/S transports. Therefore, if other transports are used, we do not have to enable the Ghost Deployer.

  • No labels