{"id":20686866,"url":"https://github.com/betrcode/java-virtual-threads-demo","last_synced_at":"2025-03-10T23:54:04.823Z","repository":{"id":140780746,"uuid":"591607479","full_name":"betrcode/java-virtual-threads-demo","owner":"betrcode","description":"A demo of virtual threads in Java 19.  Virtual threads are in preview in Java 19.  The objective of the demo is to have a somewhat fair comparison of the performance between a fixed thread pool and virtual threads when doing blocking work (not CPU intensive work).","archived":false,"fork":false,"pushed_at":"2023-01-21T09:25:52.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T16:35:36.615Z","etag":null,"topics":["java","java-19","threads"],"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/betrcode.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-01-21T09:04:39.000Z","updated_at":"2023-01-21T13:20:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"4bd16e6d-3219-494b-b3cb-4d9fa1e855a9","html_url":"https://github.com/betrcode/java-virtual-threads-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-virtual-threads-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-virtual-threads-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-virtual-threads-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-virtual-threads-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betrcode","download_url":"https://codeload.github.com/betrcode/java-virtual-threads-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242945844,"owners_count":20210762,"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":["java","java-19","threads"],"created_at":"2024-11-16T22:37:11.948Z","updated_at":"2025-03-10T23:54:04.801Z","avatar_url":"https://github.com/betrcode.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demo of performance of virtual threads in Java 19\n\nA demo of virtual threads in Java 19.\n\nVirtual threads are in preview in Java 19.\n\nThe objective of the demo is to have a somewhat fair comparison of the performance \nbetween a fixed thread pool and virtual threads \nwhen doing blocking work (not CPU intensive work).\n\nThe expectation is that virtual threads will have better resource utilization and give higher throughput.\n\nDisclaimer: This is work-in-progress and it is not at all certain that this is a fair comparison.\n\n## Prerequisites\n\nJava 19 needs to be installed.\n\n## Arguments\n\n1. Arg 1: on/off - determines if virtual threads is on or off\n2. Arg 2: integer - number of executions to run\n\n## How to run with Maven\n\nWithout virtual threads:\n```\nmvn compile exec:java -Dexec.args=\"off 5000\"\n```\n\nWith virtual threads:\n```\nmvn compile exec:java -Dexec.args=\"on 5000\"\n```\n\n## How to package and run JAR\n\nPackage as JAR\n```\nmvn package\n```\n\nRun as JAR without virtual threads\n```\njava --enable-preview -jar target/vtd-1.0-SNAPSHOT.jar off 5000\n```\n\n\nRun as JAR with virtual threads\n```\njava --enable-preview -jar target/vtd-1.0-SNAPSHOT.jar on 5000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetrcode%2Fjava-virtual-threads-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetrcode%2Fjava-virtual-threads-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetrcode%2Fjava-virtual-threads-demo/lists"}