{"id":15703996,"url":"https://github.com/mp911de/loom-playground","last_synced_at":"2025-05-12T16:28:34.090Z","repository":{"id":141688483,"uuid":"524919521","full_name":"mp911de/loom-playground","owner":"mp911de","description":"Project Loom Playground Repository","archived":false,"fork":false,"pushed_at":"2022-09-30T08:39:36.000Z","size":85,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T00:30:02.564Z","etag":null,"topics":["loom","virtual-threads"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mp911de.png","metadata":{"files":{"readme":"readme.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-08-15T09:03:16.000Z","updated_at":"2022-09-27T21:27:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec774763-8fbc-4b79-9022-1347f8762767","html_url":"https://github.com/mp911de/loom-playground","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.33333333333333337","last_synced_commit":"35baf149f66b3acc857719ed08798af5132ab636"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Floom-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Floom-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Floom-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Floom-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mp911de","download_url":"https://codeload.github.com/mp911de/loom-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253776178,"owners_count":21962447,"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","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":["loom","virtual-threads"],"created_at":"2024-10-03T20:09:45.026Z","updated_at":"2025-05-12T16:28:34.072Z","avatar_url":"https://github.com/mp911de.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loom Playground Repository\n\nThis repository contains a few selected samples to illustrate behavioral differences between Java Platform Threads and Virtual Threads.\n\nYou need at least Java 19 to run these samples and you need Postgres if you want to run the Postgres-based samples.\n\n== Examples\n\nThis repository contains three types of samples:\n\n1. link:src/main/java/loomdemo/standalone[Behavioral examples]:\n+\nThese illustrate differences in concurrency behavior using `synchronized` vs ``Lock``s.\nSee link:src/main/java/loomdemo/standalone[`loomdemo.standalone`] packages for the individual runnable classes.\n2. link:src/main/java/loomdemo/springboot[Spring Boot examples]\n+\nThe Spring Boot examples reside in link:src/main/java/loomdemo/springboot[`loomdemo.springboot`] and its subpackages.\nThe examples demonstrate how to configure Tomcat and Spring's `AsyncTaskExecutor` to use Virtual threads.\n3. link:src/test/java/benchmarks[JMH Benchmarks]\n+\nBenchmarks measure Virtual vs. Platform thread performance, specifically the throughput of creating and running a `Runnable` on a Virtual vs. Platform thread.\nSee `VirtualThreadsBenchmark.runAndAwait` and ThreadPoolExecutorBenchmark.runAndAwait` benchmark.\nThe difference in the score is an approximation for the Virtual threads overhead in comparison to pooled Platform threads.\n+\nBenchmarks are located in the link:src/test/java/benchmarks[`test`] sources and use https://github.com/mp911de/microbenchmark-runner[Microbenchmark Runner] to run benchmarks through Surefire/the JUnit 5 engine.\n\n== Container setup\n\nYou can use https://docs.docker.com/compose/compose-file/[docker compose] to run the database if you like:\n\n```\n$ docker-compose up\n...\npostgres_1  | 2022-09-27 11:54:59.006 UTC [1] LOG:  listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\npostgres_1  | 2022-09-27 11:54:59.042 UTC [59] LOG:  database system was shut down at 2022-09-27 11:54:58 UTC\npostgres_1  | 2022-09-27 11:54:59.060 UTC [1] LOG:  database system is ready to accept connections\n```\n\nThere are https://containers.dev/[devcontainers] configuration files provided so you can also use those to install the JDK. Install the https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers[Remote Containers] extension in https://code.visualstudio.com/[VSCode], open the command palette and execute `\u003eRemote-Containers: Reopen in container`, or open the project in https://github.com/codespaces[Codespaces].\n\n== Building from Source\n\nIf you want to try build this project, then use the bundled the https://github.com/takari/maven-wrapper[maven wrapper].\nYou also need JDK 19 or above.\n\n[source,bash]\n----\n $ ./mvnw clean install\n----\n\nIf you want to build with the regular `mvn` command, you will need https://maven.apache.org/run-maven/index.html[Maven v3.5.0 or above].\n\n== History\n\nFor an earlier iteration on Spring Boot and Virtual Threads see the https://github.com/mp911de/spring-boot-virtual-threads-experiment repository that contains a Spring Boot example only.\n\n== License\n\nThis project is Open Source software released under the https://www.apache.org/licenses/LICENSE-2.0.html[Apache 2.0 license].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmp911de%2Floom-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmp911de%2Floom-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmp911de%2Floom-playground/lists"}