{"id":28491708,"url":"https://github.com/kagkarlsson/threaddump-demo","last_synced_at":"2025-09-04T01:36:57.325Z","repository":{"id":237447121,"uuid":"626397136","full_name":"kagkarlsson/threaddump-demo","owner":"kagkarlsson","description":"Spring web-app which can simulate different types of slow requests. Intended for experimenting with threaddumps","archived":false,"fork":false,"pushed_at":"2023-04-12T06:28:39.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-08T03:04:15.395Z","etag":null,"topics":["java","jvm","performance","threaddump"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kagkarlsson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-11T11:43:34.000Z","updated_at":"2023-06-13T15:50:36.000Z","dependencies_parsed_at":"2024-05-02T00:43:53.043Z","dependency_job_id":"7818c973-918e-4578-b04a-4b8f9031435e","html_url":"https://github.com/kagkarlsson/threaddump-demo","commit_stats":null,"previous_names":["kagkarlsson/threaddump-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kagkarlsson/threaddump-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kagkarlsson%2Fthreaddump-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kagkarlsson%2Fthreaddump-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kagkarlsson%2Fthreaddump-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kagkarlsson%2Fthreaddump-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kagkarlsson","download_url":"https://codeload.github.com/kagkarlsson/threaddump-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kagkarlsson%2Fthreaddump-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273539293,"owners_count":25123499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","jvm","performance","threaddump"],"created_at":"2025-06-08T08:08:10.903Z","updated_at":"2025-09-04T01:36:57.302Z","avatar_url":"https://github.com/kagkarlsson.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thread-dump demo application\n\nThis is an example Spring web-app which can simulate different types of slow requests. It is intended\nto be used for experimenting with threaddumps.\n\n## Exercise\n\n1. Start the `ThreaddumpDempApplication` using your IDE or mvn\n    ```shell\n    mvn spring-boot:run\n    ```\n2. Trigger the scenario you want to test. Example scenario `database_read` here:\n   ```shell\n   curl http://localhost:8080/fakework/database_read\n   ```\n3. Take the thread-dump, for example using `jcmd` (`| less` makes it easier to browse/search). You have 20s.\n   ```shell\n   jcmd no.bekk.threaddumpdemo.ThreaddumpDemoApplication Thread.print | less\n   ```\n\n4. Find and inspect the relevant thread to see what the stack looks like for that particular scenario.\n    **Hint:** search for packages specific for this app, e.g. `no.bekk.threaddumpdemo`\n\n## Alternative ways to get a thread-dump\n\n**Hint:** Use a no-arg `jcmd` to list pids and classnames for running java-processes (might not work in some envs). \n\n```shell\njstack \u003cpid\u003e\njcmd \u003cpid\u003e Thread.print\njcmd \u003cclass-name\u003e Thread.print\n\n# If no JDK, SIGQUIT dumps threads to System.out\nkill -QUIT \u003cpid\u003e\n\n# For a Kubernetes pod (Java pid is typically 1)\nkubectl exec \u003cpod-name\u003e -- jstack 1\n```\n\n## Scenarios\n\n```\ncurl http://localhost:8080/fakework/\u003cSCENARIO\u003e\n```\n\n* `database_read` - Slow database-query\n* `tcp_connect` - Tcp-connect does not complete before timeout\n* `http_client_get` - Slow third-party webservice\n* `db_pool_get_connection` - Forced to wait for connections as pool all connections occupied\n* `lock_contention` - Forced to wait for lock held by another thread\n* `cpu_loop` - Slow local loop (i.e. pure cpu)\n\n## Thread states\n\n- `RUNNABLE` - thread is currently executing/can be executed in the jvm\n- `BLOCKED` - thread is blocked indefinitely while waiting for a lock (typically synchronized)\n- `TIMED_WAITING` - thread is waiting for a period of time (triggered by e.g Thread.sleep(..))\n- `WAITING` - thread is waiting indefinitely for another thread to perform a certain action (i.e. Object.wait()-\u003eObject.notify, ...)\n\n## Resources\n\n* [https://www.baeldung.com/java-thread-dump](https://www.baeldung.com/java-thread-dump)\n* [https://www.baeldung.com/java-analyze-thread-dumps](https://www.baeldung.com/java-analyze-thread-dumps)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkagkarlsson%2Fthreaddump-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkagkarlsson%2Fthreaddump-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkagkarlsson%2Fthreaddump-demo/lists"}