Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracing IO in java application?

Tags:

java

io

trace

I am trying to find out why Apache CXF is running away doing "something" upon first-time initialization of a web-service. "Something" is probably some kind of IO, and I'm guessing it's trying to resolve an external address/schema/DTD of some sort.

So I'm trying to find some kind of hook where I can monitor all IO. Either at VM level or at OS level (I can run on both linux and windows but I'm not allowed to run wireshark, and there is a theoretical possibility that it could be file IO).

Any suggestions on how I can track down what is happening ?

like image 991
krosenvold Avatar asked Jan 15 '09 08:01

krosenvold


2 Answers

One way if you really want do know whats happening is to run 'strace' or 'ltrace' on the apache process. There is a short introduction to it here. The interesting is that strace should block in a certain call, ie waiting for i/o if your hypothesis is correct.

To check what files (and network sockets) a certain process is using, have a look at 'lsof'. For instance, to check what files are opened by a certain process:

lsof -p process_id  # by PID
lsof -c httpd       # by a process name

To check network connections in general, try 'netstat'

like image 140
Martin Wickman Avatar answered Oct 20 '22 02:10

Martin Wickman


On windows you can use filemon, it'll list out all file accesses and allows you to filter them so you only see those of the process your interested in.

Looks like for more recent versions of windows Process Monitor is the way forward.

like image 35
Tom Avatar answered Oct 20 '22 03:10

Tom