SIGQUIT is your friend
So you are debugging this massive multi threaded server application in java that shows strange behaviour only under heavy load. Attaching a debugger isn’t much help, since it slows things down so much that problems go away. Also, sending a million requests to a server with a debugger connected is not good for the sanity of the debugger or its stats collection process.
The easiest thing to do in these situations is to send a SIGQUIT signal to the java process (in Windows, press Ctrl-Break in the console). This will dump the current stack trace for all threads in the system. You’re sure to find some interesting things in there : too many threads waiting for locks, code paths you never dreamt of, threads waiting for system calls to return … and so on.
Try it … its very instructive, and an exceptional, though under-rated, debugging tool.