Wednesday, December 8, 2021

Networking Tips


UDP Packet tcpdump and print message:

       tcpdump  -i ens192 -nnvv -A  udp port 5060 -s0 #this will print with ttl info

       tcpdump  -i ens192 -nn -A  udp port 5060 -s0 # this just print packet content

UDP Send Message:


       echo -n "hello" >/dev/udp/remoteIpAddr/5060


Found an interesting JVM Flag :

java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version

It prints hundreds of various options, I never heard about before. It also prints default values, that helps diagnose JVM behaviors better. Another interesting flag is:

-XX:+UnlockExperimentalVMOptions

Other JVM Flag :
To trigger heap dump on out of memory, you can use
 -XX:+HeapDumpOnOutOfMemoryError

This JVM option produces a stack dump when your JVM dies with OutOfMemory Error. There is no expense involved unless an OOM really occurs. This flag is a requisite for production systems as it is usually the only way to determine the problem deeply.

The heap dump will be set up in the “current directory” of the JVM by default. If you wish to create heap dumps on specific directory, then run

-XX:HeapDumpPath= [path-to-heap-dump-directory]
-XX:+UseGCOverheadLimit
-XX:OnOutOfMemoryError="< cmd args >;< cmd args >"
If we want to restart the server immediately after out of memory occur, then we can
set this parameter of the same purpose –
XX:OnOutOfMemoryError="shutdown -r"

No comments: