Multitenancy
The goal of multitenancy is to maximize resource sharing by allowing multiple users (tenants) to log in and use a single server/cluster at the same time, in a tenant-isolated manner. That is, each user is given the experience of using his/her own server, rather than a shared environment. Multitenancy ensures optimal performance of the system's resources such as memory and hardware and also secures each tenant's personal data.
Tenant admin details are saved by default into an internal H2 database. This is configurable to point to an external database if preferred. This can then be scaled appropriately. The tenants can have their own multiple directories set up and these configurations can be dynamically configured via the management console.
When multitenancy is enabled and a tenant becomes inactive for a long period of time, the tenant is unloaded from the server's memory. By default, the time period is 30 minutes. After that, the tenant has to log in again before sending requests to the server.
You change the default time period allowed for tenant inactiveness by adding -Dtenant.idle.time=<time_in_minutes>
Java property to the product's startup script ( wso2server.sh
file for Linux and wso2server.bat
for Windows) as shown below:
JAVA_OPTS \ -Dtenant.idle.time=30 \
You can register tenant domains using the management console of WSO2 products. In order to manage tenants, you need to be logged in as a super tenant.
Creating a tenant
To create a new tenant, do the following steps.
- Use admin as the username and password to log in as a super tenant.
- On the Configure tab of the management console, click Add New Tenant.
- Enter the information about this tenant as follows:
- Domain - The domain name for the organization, which should be a unique name (e.g., abc.com). This is used as a unique identifier for your domain. You can use it to log into the admin console to be redirected to your specific tenant. The domain is also used in URLs to distinguish one tenant from another.
- Usage plan for the tenant - The usage plan defines limitations (such as number of users, bandwidth, etc.) for the tenant. The Business Process Server comes with a predefined list, and you can add your item and/or tailor to the existing items. For on-premises deployment, there is only one default plan, i.e., Demo.
- First Name - First name of the tenant admin.
- Last Name - Last name of the tenant admin.
- Admin Username - The username the tenant admin will use to log in. The username must always end with the domain name (e.g.,admin@abc.com).
- Email - The email address of the admin.
Once you have added a tenant, you can log out of the Business Process Server and log back in using the newly created tenant. Now, any settings you may do using that tenant will be unique to your tenant alone. You can now deploy, manage and test applications on this tenant, using the specific tenant URL.
Viewing tenants
To view existing tenants, on the Configure tab in the Identity Server management console, click View Tenants.
Multitenancy for BPMN processes
You can configure multitenancy for BPMN processes by adding new tenants using BPS management console.
- Use admin as the username and password to log in as a super tenant.
- On the Configure tab of the management console, click Add New Tenant.
- Enter new tenant details as listed below.
- Domain - wso2.com
- Usage plan for the tenant - demo
- First Name - John
- Last Name - Porter
- Admin Username - samuel@wso2.com
- Email - samuel@wso2.com
- Create another new tenant with the tenant name abc.com, by following steps 2 and 3.
- Log in to management console with username samuel@wso2.com .
- In the Main menu, click Add under BPMN and upload a BPMN .bar file.
- Now you should be able to view the deployed BPMN process in the Main menu by clicking List under BPMN.
- Log out from your current session and log back in using the Admin Username of the second tenant (with the abc.com domain).
- Navigate to the Main menu and click List under BPMN. You will not be able to see the deployed BPMN process since it was deployed under tenant wso2.com.