{"id":33179213,"url":"https://github.com/jaksa76/paxos","last_synced_at":"2026-02-05T08:33:41.965Z","repository":{"id":91119307,"uuid":"43437247","full_name":"jaksa76/paxos","owner":"jaksa76","description":"A Java implementation of Lamport's Paxos algorithm.","archived":false,"fork":false,"pushed_at":"2024-06-29T09:39:49.000Z","size":155,"stargazers_count":92,"open_issues_count":17,"forks_count":30,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-12-02T16:24:39.836Z","etag":null,"topics":[],"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/jaksa76.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2015-09-30T14:18:31.000Z","updated_at":"2025-11-07T11:16:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"2bd5dae7-e725-46e7-93db-d35ff6d178b8","html_url":"https://github.com/jaksa76/paxos","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jaksa76/paxos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaksa76%2Fpaxos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaksa76%2Fpaxos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaksa76%2Fpaxos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaksa76%2Fpaxos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaksa76","download_url":"https://codeload.github.com/jaksa76/paxos/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaksa76%2Fpaxos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29117107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-11-16T03:00:36.826Z","updated_at":"2026-02-05T08:33:41.959Z","avatar_url":"https://github.com/jaksa76.png","language":"Java","funding_links":[],"categories":["分布式开发"],"sub_categories":[],"readme":"# Paxos\nA Java implementation of Lamport's Paxos algorithm.\n\n## Why another Paxos implementation?\n\nThis is an implementation of totally ordered atomic broadcast protocol. The algorithm used is a variant of Lamport's Paxos.\nThis library is a lightweight alternative to Apache Zookeeper. Zookeeper uses Paxos to keep consistency among the replicas,\nbut the clients are remote. This poses several limits to how Zookeeper can be used.\nOur library is used from within the VM and clients can use it to build replication with strong consistency guarantees \nregardless of how state is represented.\n\n## Why a Variant of Paxos?\n\nThe original algorithm requires state to be persisted. This significantly reduces performance, but it is required for enabling \nmembers to recover. Our solution does not support recovery of members, but instead supports changing the members of the group. \nThis allows us to avoid persistence and have a much higher throughput.\n\n## How to use it?\n\n### Basic Group\n\nThis is the basic group implementation\n\nWARNING: The BasicGroup has several limitations, you should use the Dynamic Group instead.\n\n```java\n        // this is the list of members\n        Members members = new Members(\n                new Member(), // this is a reference to a member on the localhost on default port (2440)\n                new Member(2441), // this one is on localhost with the specified port\n                new Member(InetAddress.getLocalHost(), 2442)); // you can specify the address and port manually\n\n        // we need to define a receiver\n        class MyReceiver implements Receiver {\n            // we follow a reactive pattern here\n            public void receive(Serializable message) {\n                System.out.println(\"received \" + message.toString());\n            }\n        };\n\n        // this actually creates the members\n        BasicGroup group1 = new BasicGroup(members.get(0), new MyReceiver());\n        BasicGroup group2 = new BasicGroup(members.get(1), new MyReceiver());\n        BasicGroup group3 = new BasicGroup(members.get(2), new MyReceiver());\n\n        // this will cause all receivers to print \"received Hello\"\n        group2.broadcast(\"Hello\");\n\n        Thread.sleep(1); // allow the members to receive the message\n\n        group1.close(); group2.close(); group3.close();\n```\n\n### Fragmenting Group\n\nThe BasicGroup has one big limitation: it doesn't support messages larger than a UDP packet. Even if you never send\nlarge messages, the broadcast protocol may use large messages internally to synchronize state. Large messages are\nhandled by the FragmentingGroup implementation. This implementation has a small overhead (about 10% lower throughput),\nbut supports messages of any size.\n\n### Dynamic Group\n\nAs we said before, our Paxos implementation does not support recovery of members. Instead we support adding new members\nto the group. In order to take advantage of this you must use the DynamicGroup implementation. State transfer upon\njoining is left to the user, but we guarantee that every new member receives a continguous subsequence of messages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaksa76%2Fpaxos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaksa76%2Fpaxos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaksa76%2Fpaxos/lists"}