Tuesday, February 27, 2024

How to enable GC logs in Java8

Step-by-step guide

  • Add the following lines to the integrator.sh file under $JVM_MEM_OPTS \ as below.

$JVM_MEM_OPTS \
   -XX:+HeapDumpOnOutOfMemoryError \
   -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
   -XX:+PrintGC \
   -XX:+PrintGCDetails \
   -XX:+PrintGCDateStamps \
   -Xloggc:"$PRODUCT_HOME/logs/gc.log" \
$JAVA_OPTS \

  • It will print the GC logs into gc.log file inside <product_location>/logs/ directory.

Friday, February 23, 2024

If you have encountered an issue of 'Too many open files', you can monitor the open file counts from the following commands.


TID: [-1] [] [202X-0X-XX 10:30:03,426] WARN {org.apache.synapse.transport.passthru.PassThroughHttpSSLListener} - System may be unstable: HTTPS ListeningIOReactor encountered a checked exception : Too many open files {org.apache.synapse.transport.passthru.PassThroughHttpSSLListener} java.io.IOException: Too many open files at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:424 

Monitor the open file count and the details for specific processes via the below command.

lsof -a -d ^mem -d ^cwd -d ^rtd -d ^txt -d ^DEL -p > out_with_wso2_pid.txt 

Monitor the open file count and the details from all processes running in the VM via the below command.

lsof -a -d ^mem -d ^cwd -d ^rtd -d ^txt -d ^DEL > out_for_all.txt

Thursday, February 8, 2024

How to check Master, Slave database differences

If you observed Master, Slave database difference, please execute the following SQL statements and check the results.

SELECT CONCAT(ROUND(SUM(data_length) / (1024*1024*1024),2),'GB') Data_Size, CONCAT(ROUND(SUM(index_length)/ (1024*1024*1024),2),'GB') Index_Size, CONCAT(ROUND((sum(data_length)+sum(index_length))/(1024*1024*1024),2),'GB') Total_Size  FROM information_schema.TABLES  WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'sys')  GROUP BY NULL; 

SELECT table_schema, table_name, CONCAT(ROUND((data_free / 1024 / 1024),2),'MB') data_free  FROM information_schema.tables  WHERE table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')    AND ENGINE LIKE 'InnoDB' AND data_free > 100 * 1024 *  1024;