Performance Tuning Guide
The following sub-sections discuss the various performance tuning recommendations that need to be applied for WSO2 EMM, and the configurations that need to take place:
OS Level Settings
This section describes some recommended performance tuning configurations to optimize WSO2 EMM. It assumes that you have set up WSO2 EMM on Unix/Linux, which is recommended for a production deployment.
To optimize OS performance, increase the file descriptor count as follows in theÂ
/etc/sysctl.conf
file of Linux. For more information, see Setting the file descriptor count.
fs.file-max = 2097152
To alter the number of allowed open files for system users, configure the following settings in the
limits.conf
 Linux file, which is in theÂ/etc/security/
directory. For more information see, Setting maximum open file descriptor limits.* soft nofile 4096 * hard nofile 65535
Optimal values for these parameters depend on the environment.
To alter the maximum number of processes your user is allowed to run at a given time, configure the following settings in the Â
/etc/security/limits.conf
 file of Linux (be sure to include the leading * character). Each carbon server instance you run would require upto 1024 threads (with default thread pool configuration). Therefore, you need to increase the nproc value by 1024 for each carbon server (both hard and soft).* soft nproc 20000 * hard nproc 20000
JVM-level settings
If one or more worker nodes in a clustered deployment require access to the management console, you would need to increase the entity expansion limit as follows in the <EMM_HOME>/bin/wso2server.bat
 file (for windows) or the <EMM_HOME>/bin/wso2server.sh
file (for Linux/Solaris). The default entity expansion limit is 64000.
-DentityExpansionLimit=100000
WSO2 EMM Settings
- Memory allocated for WSO2 EMM can be changed by modifying the
wso2server.sh
file, which is in theÂ<EMM_HOME>/bin/
directory. For more information see, Setting JVM memory allocation limits for WSO2 EMM. - Increase the pool size of the database connections. We recommend having 200 connections per datasource in production instances. This can be changed by setting the
<maxActive>
property to 200 in the relevant datasourcesÂmaster-datasources.xml
file, which is in theÂ<EMM_HOME>/repository/conf/datasources/
directory.
Setting the file descriptor count
The maximum file descriptor limit should be 2097152. If you wish to check the file descriptor count, execute the following command: sysctl fs.file-nrÂ
The above command will return counts of file descriptors in the following format:Â <in_use> <unused_but_allocated> <maximum>
Follow the instructions below to increase the file descriptor count:
- Log in as aÂ
root
 user. Open theÂ
sysctl.conf
file, which is in theÂ/etc/
directory.Add or edit the following line in the file as follows and reboot the system.
fs.file-max = 2097152
Setting maximum open file descriptor limits
Follow the instructions below to set the maximum open file descriptor limits in Linux:
- Log in as a
root
user. - Open theÂ
limits.conf
 file, which is in theÂ/etc/security/
 directory. Add or edit the following two lines in the file.
* soft nofile 4096 * hard nofile 65535
An asterisk * has been added at the start of the entry to set the maximum open file descriptor limit for all the users. However, if you wish to set the open file descriptor limit only for a specific user, enter that respective user's username instead of an asterisk.
- The soft limit defines the minimum number of file handles or open files that the users will have after they log in.Â
The hard limit defines the maximum number of file handles or open files that the users will have after they log in.Â
If you encounter an error message about running out of file handles, then the hard limit can be increased.
Setting JVM memory allocation limits for WSO2 EMM
Follow the instruction below to change the JVM memory allocation limits for WSO2 EMM:
- Navigate to the
<EMM_HOME>/bin/
directory and open theÂwso2server.sh
 file. - Locate the following entry:
-Xms256m -Xmx1024m -XX:MaxPermSize=256mÂ
- Update the above entry as follows and save theÂ
wso2server.sh
 file.
-Xms2048m -Xmx2048m -XX:MaxPermSize=1024mÂ
The Java Virtual Machine (JVM) memory allocation pool limits have been described as follows:
-
-Xms
-
This specifies the initial memory allocation pool for a JVM. -
-Xmx
Â
-
This specifies the maximum memory allocation pool for a JVM. -XX:MaxPermSize
-Â
The permanent space is where the classes, methods, internalized strings, and similar objects used by the VM are stored and never deallocated. This defines the maximum space that will be allocated as permanent space.The default JDK value is assigned to XX:MaxPermSize from JDK 8 and above. Therefore you need not use the
XX:MaxPermSize
if you are running WSO2 EMM on JDK 8 and above.
-