The NextGen gateway provides the capability to generate thread dump and heap dump in order to identify issues within the vprobe application. A thread dump captures the current state of all threads in a Java process, while a heap dump is useful for detecting memory leaks.
Case 1: If you face any thread blocking issues?
Using the following commands you can generate the thread dump in the NextGen gateway.
Get the process id for the vprobe process using the following command.
kubectl exec -it nextgen-gw-0 -c vprobe -- /bin/bash -c 'ps -ef | grep vprobe' gateway 1 0 0 06:20 ? 00:00:00 /bin/bash /opt/gateway/vprobe/bin/vprobe.sh gateway 7 1 20 06:20 ? 00:00:38 java -Djava.naming.provider.url=file:/opt/gateway/vprobe/temp/jndi -Dserver.home= -Dsun.net.inetaddr.ttl=0 -Djava.net.preferIPv4Stack=true -Dhttp.nonProxyHosts=localhost -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2,SSLv3 -Djdk.tls.client.protocols=TLSv1,TLSv1.1,TLSv1.2,SSLv3 -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80 -XX:+ExitOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/app/vprobe-jvm-thread.dump -classpath /opt/gateway/vprobe/conf:/opt/gateway/vprobe/lib/:/opt/gateway/vprobe/lib/* com.vistara.gateway.core.VistaraGateway
Generate a thread dump using the following command.
kubectl exec -it nextgen-gw-0 -c vprobe -- /bin/bash -c '/jcmd/bin/jcmd 7 Thread.print' > /tmp/threaddumpnew.dump
Note
Here 7 is the process id and not the fixed id.
Case 2: If you face any memory leaks (this will cause application out of memory issues)?
Using the following commands you can generate the heap dump in the NextGen gateway.
Get the process id for the vprobe process using the following command.
kubectl exec -it nextgen-gw-0 -c vprobe -- /bin/bash -c 'ps -ef | grep vprobe' gateway 1 0 0 06:20 ? 00:00:00 /bin/bash /opt/gateway/vprobe/bin/vprobe.sh gateway 7 1 20 06:20 ? 00:00:38 java -Djava.naming.provider.url=file:/opt/gateway/vprobe/temp/jndi -Dserver.home= -Dsun.net.inetaddr.ttl=0 -Djava.net.preferIPv4Stack=true -Dhttp.nonProxyHosts=localhost -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2,SSLv3 -Djdk.tls.client.protocols=TLSv1,TLSv1.1,TLSv1.2,SSLv3 -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80 -XX:+ExitOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/app/vprobe-jvm-thread.dump -classpath /opt/gateway/vprobe/conf:/opt/gateway/vprobe/lib/:/opt/gateway/vprobe/lib/* com.vistara.gateway.core.VistaraGateway
Generate a heap dump using the following command.
kubectl exec -it nextgen-gw-0 -c vprobe -- /bin/bash -c '/jcmd/bin/jcmd 7 GC.heap_dump /opt/gateway/content/heapdump.hprof' 7: Dumping heap to /opt/gateway/content/heapdump.hprof ... Heap dump file created [75406258 bytes in 0.795 secs]
Note
- Here 7 is the process id and not the fixed id.
- You can find the heap dump file content of pvc folder in the node.