This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
API Manager-level settings
Timeout configurations for an API call
The following diagram shows the communication/network paths that occur when an API is called. The timeout configurations for each network call are explained below.
Key validation
Key validation occurs via a Servlet HTTP call and the connection timeout can be configured by changing the following configuration details in the<WSO2_OB_APIM_HOME>/repository/conf/axis2/axis2_client.xml
file. All timeout values are in milliseconds.<transportSender name="https" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> <parameter name="SO_TIMEOUT">60000</parameter> <parameter name="CONNECTION_TIMEOUT">60000</parameter> </transportSender>
If the Key Manager caching is enabled, the calls between the API Gateway and Key Manager are cached. As a result, the Key Manager is not invoked for each API call.
Client call API Gateway + API Gateway call Backend
For backend communication, the API Manager uses PassThrough transport. This is configured in the<WSO2_OB_APIM_HOME>/repository/conf/passthru-http.properties
file. For more information, see Configuring passthru-http.properties in the EI documentation.Note that the default value for
http.socket.timeout
differs between WSO2 products. In WSO2 API-M, the default value forhttp.socket.timeout
is 180000ms.
General APIM-level recommendations
Some general APIM-level recommendations are listed below:
Improvement Area | Performance Recommendations | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
API Gateway nodes | Increase memory allocated by modifying the
Set the following in the
<parameter name="defaultMaxConnPerHost">1000</parameter> <parameter name="maxTotalConnections">30000</parameter> The above configurations are only applicable when WS key validation is enabled. | ||||||||||||||
NHTTP transport of API Gateway | Recommended values for the Property descriptions:
Recommended values:
| ||||||||||||||
PassThrough transport of API Gateway | Recommended values for the Property descriptions
Recommended values
| ||||||||||||||
Timeout configurations | The API Gateway routes the requests from your client to an appropriate endpoint. The most common reason for your client getting a timeout is when the Gateway's timeout is larger than the client's timeout values. You can resolve this by either increasing the timeout on the client's side or by decreasing it on the API Gateway's side. Here are a few parameters, in addition to the timeout parameters discussed in the previous sections.
| ||||||||||||||
Key Manager nodes | 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 sudo sysctl -p Set the following in the If you use WSO2 Identity Server (WSO2 IS) as the Key Manager, then the root location of the above path and the subsequent path needs to change from maxThreads="750" minSpareThreads="150" disableUploadTimeout="false" enableLookups="false" connectionUploadTimeout="120000" maxKeepAliveRequests="600" acceptCount="600" Set the following connection pool elements in the <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> Note that you set the |
Registry indexing configurations
The registry indexing process is only required to be run on the API Publisher and API Store nodes. To disable the indexing process from running on the other nodes (Gateways and Key Managers), you need to set the <wso2registry><indexingConfiguration><startIndexing>
element to false in the <WSO2_OB_APIM
_HOME>/repository/conf/registry.xml
file of the relevant nodes.
Registry Caching based configurations
When Registry caching is enabled, it requires a unique ID in order to cache the resources. The getConnectionId method gets called in the latter mentioned situation order to retrieve the username of the connection. In the case of some database vendors, the getConnectionId method makes a database call to fetch the latter mentioned information. Such a database call is a massive overhead because the getConnectionId method frequently gets called. Therefore, it is recommended to avoid those database calls in order to improve the performance.
You need to get the latest product updates for your product to use the following instructions in the current version of WSO2 API-M. This feature is available as a product update from February 20, 2020 onwards.
Note that you can deploy updates in a production environment only if you have a valid subscription with WSO2. Read more about WSO2 Updates.
Follow the instructions below to avoid those database calls and improve the performance during Registry Caching.
Add the following JVM parameter in the
<WSO2_OB_APIM
_HOME>/bin/wso2server.sh
(for Linux/Mac OS) or<WSO2_OB_APIM
_HOME>/bin/wso2server.bat
(for Windows OS) file based on your OS and save the file.-Dcarbon.registry.database.connectionid.avoiddbcalls=true
- Restart the WSO2 API Manager server.
Throttle data and Analytics-related settings
This section describes the parameters you need to configure to tune the performance of API-M Analytics and Throttling when it is affected by high load, network traffic etc. You need to tune these parameters based on the deployment environment.
Tuning carbon.xml parameters
The following parameter is configured in the <<WSO2_OB_APIMAPI-M_HOME>/repository/conf/carbon.xml
file:
Parameter | Description | Default Value | Tuning Recommendation |
---|---|---|---|
AnalyticsServerPublishingInterval
| The number of milliseconds that should elapse after a batch of statistical data is processed to be published in the Analytics Dashboard before sending another batch. | 2000 | The default value of 2000 milliseconds (i.e. 5 seconds) is recommended. When WSO2 API-M is handling a high load of requests, this value can be reduced to increase the frequency with which the resulting statistics published in the Analytics Dashboard. This helps to avoid storing too much data in WSO2 API-M causing an overconsumption of memory. When the load of requests handled by WSO2 API-M is comparatively low, this time interval can be increased to reduce the system overhead incurred by frequent processing. |
Tuning data-agent parameters
The following parameters should be configured in the <WSO2_OB_AM_
ANALYTICS_HOME>/repository/conf/data-bridge/data-agent-config.xml
file. Note that there are two sub-sections in this file, named Thrift and Binary.
<DataAgentsConfiguration> <Agent> <Name>Thrift</Name> ... </Agent> <Agent> <Name>Binary</Name> ... </Agent> </DataAgentsConfiguration>
The Thrift section is related to Analytics and the Binary section is related to Throttling. Same set of parameters mentioned below can be found in both sections. The parameter descriptions and recommendations are intended towards the for performance tuning of Analytics, but the same recommendations are relevant for Throttling data related tuning in the Binary section. Note that the section for Thrift is relevant only if Analytics is enabled.
Parameter | Description | Default Value | Tuning Recommendation |
---|---|---|---|
QueueSize | The number of messages that can be stored in WSO2 API-M at a given time before they are published to the Analytics Server. | 32768 | This value should be increased when the Analytics Server is busy due to a request overload or if there is high network traffic. This prevents the generation of the queue When the Analytics server is not very busy and when the network traffic is relatively low, the queue size can be reduced to avoid an overconsumption of memory. The number specified for this parameter should be a power of 2. |
BatchSize | The WSO2 API-M statistical data sent to the Analytics Server to be published in the Analytics Dashboard are grouped into batches. This parameter specifies the number of requests to be included in a batch. | 200 | This value should be tuned in proportion to the volume of requests sent from WSO2 API-M to the Analytics Server. This value should be reduced if you want to reduce the system overhead of the Analytics Server. This value should be increased if WSO2 API-M is generating a high amount of statistics and if the QueueSize cannot be further increased without causing an overconsumption of memory. |
CorePoolSize | The number of threads allocated to publish WSO2 API-M statistical data to the Analytics Server via Thrift at the time WSO2 API-M is started. This value increases when the throughput of statistics generated increases. However, the number of threads will not exceed the number specified for the MaxPoolSize parameter. | 1 | The number of available CPU cores should be taken into account when specifying this value. Increasing the core pool size may improve the throughput of statistical data published in the Analytics Dashboard, but latency will also be increased due to context switching. |
MaxPoolSize | The maximum number of threads that should be allocated at any given time to publish WSO2 API-M statistical data to the Analytics Server. | 1 | The number of available CPU cores should be taken into account when specifying this value. Increasing the maximum core pool size may improve the throughput of statistical data published in the Analytics Dashboard, since more threads can be spawned to handle an increased number of events. However, latency will also increase since a higher number of threads would cause context switching to take place more frequently. |
MaxTransportPoolSize | The maximum number of transport threads that should be allocated at any given time to publish WSO2 API-M statistical data to the Analytics Server. | 250 | This value must be increased when there is an increase in the throughput of events handled by WSO2 API-M Analytics. Example dataReceivers: - # Data receiver configuration dataReceiver: # Data receiver type # THIS IS A MANDATORY FIELD type: Thrift # Data receiver properties properties: tcpPort: '7611' sslPort: '7711' tcpMaxWorkerThreads: '1750' sslMaxWorkerThreads: '1750' |
SecureMaxTransportPoolSize | The maximum number of secure transport threads that should be allocated at any given time to publish WSO2 API-M statistical data to the Analytics Server. | 250 | This value must be increased when there is an increase in the throughput of events handled by WSO2 API-M Analytics. The value of the Example dataReceivers: - # Data receiver configuration dataReceiver: # Data receiver type # THIS IS A MANDATORY FIELD type: Thrift # Data receiver properties properties: tcpPort: '7611' sslPort: '7711' tcpMaxWorkerThreads: '1750' sslMaxWorkerThreads: '1750' |