This documentation is for WSO2 Carbon 4.4.0. View documentation for the latest release.
Page Comparison - Configuring the Tenant Loading Policy (v.14 vs v.15) - Carbon 4.4.0 - WSO2 Documentation
Due to a known issue do not use JDK1.8.0_151 with WSO2 products. Use JDK 1.8.0_144 until JDK 1.8.0_162-ea is released.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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 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 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.

Now, see the instructions given below to configure the required tenant loading policy for your system.

...

As explained above, Lazy Loading (for tenants) is enabled as the loading policy in WSO2 products, by default. To verify that Lazy loading is enabled, open the carbon.xml file xml file (stored in the in the <PRODUCT_HOME>/repository/conf directory) and see that see that <LazyLoading> is uncommented  is uncommented as shown below.

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

...

  • Specify the tenant idle time when you configure the tenant loading policy:
    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.

      Code Block
      <Tenant>
         		 <LoadingPolicy>
            	     <LazyLoading>
                 		 	<IdleTime>30</IdleTime>
             		 </LazyLoading>-->
             	 <!--<EagerLoading>
                 			<Include>*,!foo.com,!bar.com</Include>
             		 </EagerLoading>-->
        		</LoadingPolicy>
      </Tenant>
  • Alternatively, you can specify the tenant idle time when you start the server:

    1. Open the product startup script (./wso2server.sh file for Linux and wso2server.bat for Windows), which is stored in the in the <PRODUCT_HOME>/bin directory.
    2. Add the following system property.

      Code Block
      $JAVA_OPTS \ 
           -Dtenant.idle.time=<value_in_minutes. \
    3. Restart the server.

...