This documentation is for WSO2 API Manager 1.6.0 View documentation for the latest release.
Tuning Performance - API Manager 1.6.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

This section describes some recommended performance tuning configurations to optimize the API Manager. It assumes that you have set up the API Manager on Unix/Linux, which is recommended for a production deployment. We also recommend a distributed API Manager setup for most production systems. Out of all components of an API Manager distributed setup, the API Gateway is the most critical, because it handles all inbound calls to APIs. Therefore, we recommend you to have at least a 2-node cluster of API Gateways in a distributed setup.

The values we discuss below are only general recommendations for the API Gateway. They work best when there are 350 to 30000 calls per second to the API Gateway. They might not be the optimal for the specific hardware configurations in your environment. We recommend you to carry out load tests on your environment to tune the API Manager accordingly.

Improvement AreaPerformance Recommendations
API Gateway nodes

Increase memory allocated by modifying /bin/wso2server.sh with the following setting:

  • -Xms2048m -Xmx2048m -XX:MaxPermSize=1024m
NHTTP and PT HTTP transports of API Gateway

Set the following in /repository/conf/nhttp.properties file:

  • http.socket.timeout=60000
  • snd_t_core=200 
  • snd_t_max=250 
  • snd_io_threads=16 
  • lst_t_core=200 
  • lst_t_max=250 
  • lst_io_threads=16 

Note that the number of threads should be equal to the number of processor cores .

Key management nodes

Apply the following to get the maximum outcome for login requests.

Set the following in <APIM_HOME>/repository/conf/axis2/axis2_client.xml file:

<parameter name="defaultMaxConnPerHost">1000</parameter> 
<parameter name="maxTotalConnections">30000</parameter> 

Set the MySQL maximum connections:

mysql> show variables like "max_connections"; 
 max_connections was 151 
 set to global max_connections = 250; 

Set the open files limit to 200000 by editing the /etc/sysctl.conf file:

sudo sysctl -p

Set the following in CatlinaServer.sh batch file:

maxThreads="750" 
minSpareThreads="150" 
disableUploadTimeout="false" 
enableLookups="false" 
connectionUploadTimeout="120000" 
maxKeepAliveRequests="600" 
acceptCount="600" 

Set the following connection pool elements in <APIM_HOME>/repository/conf/datasources/master-datasources.xml file:

<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>

Note that you set the <testOnBorrow> element to true and provide a validation query (e.g., in Oracle, SELECT 1 FROM DUAL), which is run to refresh any stale connections in the connection pool. Set a suitable value for the <validationInterval> element, which defaults to 30000 milliseconds. It determines the time period after which the next iteration of the validation query will be run on a particular connection. It avoids excess validations and ensures better performance.

  • No labels