{"id":18925554,"url":"https://github.com/nightmachinery/distributed-prime-generator","last_synced_at":"2026-03-14T15:30:17.241Z","repository":{"id":115498624,"uuid":"182258717","full_name":"NightMachinery/distributed-prime-generator","owner":"NightMachinery","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T08:42:34.000Z","size":22,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T17:48:03.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/NightMachinery.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":"2019-04-19T12:05:26.000Z","updated_at":"2021-04-16T15:42:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"17445809-9c80-465f-8a2c-212bc2aa58e1","html_url":"https://github.com/NightMachinery/distributed-prime-generator","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/NightMachinery%2Fdistributed-prime-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2Fdistributed-prime-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2Fdistributed-prime-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2Fdistributed-prime-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NightMachinery","download_url":"https://codeload.github.com/NightMachinery/distributed-prime-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239921844,"owners_count":19718844,"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":[],"created_at":"2024-11-08T11:12:19.245Z","updated_at":"2026-03-14T15:30:17.156Z","avatar_url":"https://github.com/NightMachinery.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed Prime Generation with Akka\n\nWe use a distributed variation on the sieve of Eratosthenes to generate primes. The clients (SilverSlaves) pull work from the master (DarkLord), and also pull needed data. The master talks with a storage actor (named ColdCellar) to save and load data. Master periodically generates tasks to give out to clients. Master does not care about giving duplicate or even already-done jobs, and this makes it able to store no state on clients. However, the logic of task delivery and generation has been set up such that duplicate tasks should be rare.\nAn Allseer actor is used to ask the master for outputting primes. It supports doing this periodically.\nAll components are very resilient against crashes, though a supervisor might be needed to actually restart them. Akka does restart actors it recognizes as crashed. The clients don't have any meaningful state (beyond their current task, which they can safely lose), and master just uses ColdCellar for its important state. We persist the data in ColdCellar almost completely on disk, so the system will recover all done jobs. Reconnection is also done automatically through Akka.\n\n## Docker\n\nThere are dockerfiles for all three main modules: docker-id (the master), docker-ss (the clients), docker-as (Allseer). You need to first build their base image (run the commands from the repository's root):\n\n`docker build --tag bd971-base -f docker-base .`\n\nThen you can run these:\n```\ndocker build --tag bd971-id -f docker-id .\ndocker build --tag bd971-ss -f docker-ss .\ndocker build --tag bd971-as -f docker-as .\n```\n\nNow you can start them:\n```\ndocker run -p2557:2551 bd971-as\ndocker run -p2556:2551 bd971-ss\ndocker run -p2555:2551 bd971-ss\ndocker run -p2552:2552 bd971-id\n...\n```\n\nNote that since clients and Allseer have been configured for Docker, you can't run multiple instances of them on the same OS (same container); Because they all connect to a single port. You need to run them inside unique containers with uniquely configured ports (as you can see in the example).\n\nThe server though should always be run on `-p2552:2552`. You also need to specify the server's IP in the source code, both in the SharedSpace.scala and application.conf; This address needs to be accessible from inside the containers, so you can't use the localhost.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightmachinery%2Fdistributed-prime-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnightmachinery%2Fdistributed-prime-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightmachinery%2Fdistributed-prime-generator/lists"}