{"id":15536609,"url":"https://github.com/zedd45/multithreading-web-workers-example","last_synced_at":"2025-03-28T23:12:31.790Z","repository":{"id":142997169,"uuid":"530912330","full_name":"zedd45/multithreading-web-workers-example","owner":"zedd45","description":"Web Workers for Node JS, based on Digital Ocean Tutorial","archived":false,"fork":false,"pushed_at":"2022-09-01T22:51:48.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T09:43:00.886Z","etag":null,"topics":["multithreading","webworkers"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zedd45.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":"2022-08-31T02:47:28.000Z","updated_at":"2024-03-01T21:18:49.000Z","dependencies_parsed_at":"2023-07-19T08:57:03.505Z","dependency_job_id":null,"html_url":"https://github.com/zedd45/multithreading-web-workers-example","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"05009794ff128e98f51c25bbe4cb27697d22f4ee"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zedd45%2Fmultithreading-web-workers-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zedd45%2Fmultithreading-web-workers-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zedd45%2Fmultithreading-web-workers-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zedd45%2Fmultithreading-web-workers-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zedd45","download_url":"https://codeload.github.com/zedd45/multithreading-web-workers-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246112670,"owners_count":20725301,"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":["multithreading","webworkers"],"created_at":"2024-10-02T11:52:40.069Z","updated_at":"2025-03-28T23:12:31.774Z","avatar_url":"https://github.com/zedd45.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multithreading Example\n\nThis is an implementation of Digital Ocean's tutorial on [Multithreading using Webworkers in Node](https://www.digitalocean.com/community/tutorials/how-to-use-multithreading-in-node-js).\n\nI followed the tutorial, but made some changes, including using obtaining the number of threads from the machine's info, rather than assuming 4.\n\nThe multi-core server runs on port 3001 to prevent confusion, but I wouldn't recommending running both servers at the same time, as it will tamper with the results if you make requests to both.\n\nTo get the time for a blocking request, run:\n```shell\n# single core\ntime curl --get http://localhost:3000/blocking\n\n# multi-core\ntime curl --get http://localhost:3001/blocking\n```\n\nThe difference in results on a 2019 MBP (8 core i9 with HyperThreading) were pretty impressive: \n\n```shell\n# Single Core\n$ time curl --get http://localhost:3000/blocking\nresult is 20000000000\n________________________________________________________\nExecuted in   20.57 secs      fish           external\n   usr time    4.83 millis  130.00 micros    4.70 millis\n   sys time    7.94 millis  900.00 micros    7.04 millis\n   \n# Multi-Core\n$ time curl --get http://localhost:3001/blocking\nresult is 20000000000\n________________________________________________________\nExecuted in  799.82 millis    fish           external\n   usr time    4.15 millis  107.00 micros    4.05 millis\n   sys time    7.00 millis  895.00 micros    6.11 millis\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzedd45%2Fmultithreading-web-workers-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzedd45%2Fmultithreading-web-workers-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzedd45%2Fmultithreading-web-workers-example/lists"}