I am looking for a way to list all the synchronization calls of a running parallel Java application in order to detect scalability issues (in terms of threads / cores). As I understand it, every time a synchronized block is entered, the machine needs to synchronize caches. This affects all running processors (in several ways, for example, memory bandwidth), even if running tasks are not blocked by entering a synchronized area.
Setup:
I have a large application that is parallelized at a higher level, that is, it performs complex tasks that are performed in parallel. Parallelization works in the sense that all cores are under load and I have no blocked threads. However, performance does not scale with kernels, which may have several reasons. The specific possible reason I'm interested in is that there are many synchronization calls (e.g. entering a synchronized block using a lock, etc.).
Task
I would like to know what places in my code (which are actually being executed) have such a synchronization call and how often each synchronization is performed. There are many libraries with links, so it’s impossible to use a regular code search by the synchronization keyword or something like that, because it will lead to a search for a large number of never-executable code and cause a lot of false positives. The ideal solution is to have a profiler that lists all the synchronization locations that are running and the number of calls. However, the profilers I tried only allow you to count method calls. Therefore, the problem is to find all the methods that are really relevant.
, , - ( ). , .. . , .
, .
.