Using Java mission control to do I/O and Socket analysis of Java application
JMC is a tool which comes bundled with JDK since version 7u4 and it is an awesome tool for managing, monitoring, profiling, and troubleshooting Java applications. We can do memory analysis(heap dumps, Garbage collector analysis, hot methods, hot classes in terms percentage memory/time spent etc), threads analysis(finding deadlocks, thread dumps, per thread CPU usage etc), IO/Socket operations analysis(size/time taken for reading/writing to IO/socket) and many more things with very high level details.
In this article we will be focusing on I/O and socket analysis
This tab is divided into 4 sections : File read, File write, Socket read and socket write apart from overview section. Each section has further sub sections -“By File”, “By Thread” and “By Event”. The 2 first tabs group operations by file and by thread. The last tab simply lists all I/O events
follow site File Read
Here we can see how many times your application read files from the disk. It will list down all the files along with the time taken to complete the operation. bytes read and number of times it was read. You can use these info to answer these questions
- Do I see any unexpected I/O operations (on files I don’t expect to see here)?
- Do I read the same file multiple times?
- Are the read block sizes expected? Aren’t they too small?
Very similar to File read tab. Here you will analyze the files written to disk by your application
http://ledrepair.in/contact/ Socket Read
In this tab you will analyze all socket related read calls. For example reading data from database, invoking an external API like Facebook’s API. Here you can analyze which API calls are slow performing and how are DB calls performing