You’ll first have to determine why it’s slow. It’s typically due to a physical resource being put under stress. So, next time your system becomes slow, jump into the server and run some commands to see if any resource is being maxed out (e.g. CPU, memory, disk). If you’re not savvy enough with these types of sys admin tasks, have a sys admin do this for you.
In the event that your CPU is being maxed out and it is being maxed out by the IS, there are additional steps to help you pinpoint exactly what thread within that process is causing the issue. You can then marry that information with the thread dump, as suggested by Mahesh, to identify your culprit.
While you do this, here are a couple of thoughts:
9 GB seems like a lot to me, especially for a development environment. Do you know why it was set to this value?
The fact that you see the memory jumping from 6 to 8 GB, and you’re getting close to reaching that 9 GB limit, could indicate that the slowdown is due to Garbage Collection. If that’s the case, you should determine whether the memory usage/spike is expected or if there’s a bug in your application causing an unnecessary spike (e.g. loading large objects into memory instead of streaming them)
Although setting the min/max heap to the same value is a pretty common practice, you should be aware of possible unintended effects, such as delaying Garbage Collection until that threshold is almost reached. In your case, since your heap is relatively large, when Garbage Collection does end up running, it will have a much more noticeable impact on the performance of your application since it will take longer to run.