Overhead Added by Collecting Thread Dumps

A thread dump is a snapshot of all the threads running in a Java process. It’s a vital artifact to troubleshoot various production problems such as CPU spikes, unresponsiveness in the application, poor response time, hung threads, high memory consumption. Thus to facilitate troubleshooting, we have seen enterprises capture thread dumps on a periodic basis (every 5 minutes or 2 minutes). So we were curious to learn the overhead of capturing thread dump on a periodic basis. Thus we set out to conduct the below case study.

Environment

For our study, we chose to use the open-source Spring Boot Pet Clinic application. Pet Clinic is a poster child application that was developed to demonstrate the Spring Boot framework features. 

Chaos Engineering: Blocked Threads

In the series of chaos engineering articles, we have been learning to simulate various performance problems. In this post, let’s discuss how to make threads go into a BLOCKED state.

Sample Program

Here is a sample program from the open-source BuggyApp application, which would make threads go into a BLOCKED state. A thread will enter into a BLOCKED state when it couldn’t acquire a lock on an object because another thread already holds the lock on the same object and doesn’t release it. Review the program carefully.