Our Tomcat web application feels slow when it is used by a couple hundred users. The servers are in a hosting company and their reports doesn't show any problem with bandwith or cpu workload, so I suspect that the reason of the slowdowns can be because of contention on some legacy code that we encapsulated under synchronized calls because it was the easier path.
I've done some artificial tests in the developement environment changing the synchronized calls with a ThreadLocal solution and it becomes faster, but I know that my boss will require me some evidence that it will also be faster in production.
How can I know for sure if thread contention is a problem in my app?
I think the thread details view of the visualVM tool that comes with recent Java 6 JDKs will be able to provide solid evidence for (or against) your theory. It displays a pie chart for each thread, showing how much time it's spending running, sleeping, waiting and in a monitor. The last (displayed in red) is what you're interested in: