How to measure I/O time for a java application running on ubuntu?

◇◆丶佛笑我妖孽 提交于 2019-12-10 19:44:35

问题


I would like to gather amount of time my application is waiting for I/O. I am running this java application on ubuntu/linux. I am using yourkit profiler. Suggest if there any other profiling tool for measuring I/O time.


回答1:


Youtkit is excellent for having a zoom microscope in your application. In these situations it often pays to also look from the outside to a macroscopic view and take some very rough measurements to see if you are CPU bound or IO bound.

If your app running at full throttle on an otherwise "empty" only uses 10% CPU (and by extension it is roughly 90% waiting for IO) then investigating what you can do on the IO side makes a lot of sense if you want to increase throughput. If on the other hand all your cores are running over 90% you wont be gaining much there as our app is CPU bound. The commands top, iostat and vmstat can give these rough estimates.

strace can give insight in how manytimes files are openened and closed, read operations performed, etc, .... In this case also learn to use grep or perl to sift through the mountain of data this tool produces.

Keep an eye on how efficiently memory is used and know your infrastructure. If you see in vmstat that large number of blocks are swapped in and out retune memory till that drops to zero or all other effort is relatively useless.

It is not clear from your question if your focus is latency, jitter, throughput, ... but these kind of relatively quick rough estimates help determining where to look with the microscope.




回答2:


You can use RotateRight/Zoom or LTProf. Or, if you're not after high precision, you can just take 10 or 20 stack samples using lsstack and see what percent are in I/O, or do the equivalent thing in Java.




回答3:


Use strace to watch system I\O calls. Read the man page for an introduction.



来源:https://stackoverflow.com/questions/3568974/how-to-measure-i-o-time-for-a-java-application-running-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!