WSO2 APIM | Server Startup Heap Size Changes

Hello WSO2 folks, I'll be sharing another good experience of WSO2 APIM production monitoring & troubleshooting.

Environment
WSO2 API Manager v3.2.0.x

Use Case
We have deployed WSO2 API Manager v3.2.0.x on the OpenShift Container platform and got some critical observations in carbon logs. The initial deployment was successful and carbon logs were not printing any error messages. So the APIs are configured via the publisher portal, and subscriptions are done via the dev portal. API calls started and traffic on gateway components started. However, after some time we noticed that the API gateway calls are getting failed with HTTP 5XX error codes.

Root Cause Analysis
We have done the analysis of the issue and found that there is a heap size issue in the carbon server and it's resulting in the API gateway component going down. Following error logs were identified-
java.lang.OutOfMemoryError: Java heap space

Ther Solution
This problem has arisen due to insufficient memory i.e. RAM allocation to the carbon. The good thing this that it's a configuration change in our startup script i.e. wso2server.sh. Following changes are to be done as per the requirement-

File Location: $APIM_HOME/bin/wso2server.sh or wso2server.bat ( for windows )
Changes to: JVM_MEM_OPTS parameter
From: JVM_MEM_OPTS="-Xms256m -Xmx1024m"
To : JVM_MEM_OPTS="-Xms2048m -Xmx2048m"

Restart the server and that's it. The new heap allocation will show in carbon startup logs similar to the below message-

Using Java memory options: -Xms2048m -Xmx2048m


Once the server started successfully, the application will utilize the heap size as provided. 

Note:
For Containerised deployment viz. docker, Kubernetes, OpenShift, we can get the changes done through the config map of the wso2server.sh file.

Comments

Popular posts from this blog

Oracle SOA Suite- Implementing Email Notification

Oracle SOA Suite 12c- PKIX path building failed & unable to find valid certification path to requested target

Migration of Oracle SOA Suite Composite from 11g to 12c