How to measure I/O time for a java application running on ubuntu?
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 m开发者_如何学编程easuring I/O time.
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.
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.
Use strace
to watch system I\O calls. Read the man
page for an introduction.
精彩评论