{"id":19889329,"url":"https://github.com/codeprometheus/starry-rpc","last_synced_at":"2026-04-13T08:31:16.868Z","repository":{"id":104067376,"uuid":"369453340","full_name":"CodePrometheus/Starry-RPC","owner":"CodePrometheus","description":"实现一个基本功能完善的RPC，Netty，Zookeeper，Nacos，Redis，Kyro，Snappy","archived":false,"fork":false,"pushed_at":"2021-10-22T14:12:18.000Z","size":114,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-29T12:58:53.528Z","etag":null,"topics":["kyro","nacos","netty","rpc","zookeeper"],"latest_commit_sha":null,"homepage":"","language":"Java","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/CodePrometheus.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":"2021-05-21T07:37:18.000Z","updated_at":"2021-10-22T14:12:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e3679cd-8f73-433f-aa76-e73f459aa606","html_url":"https://github.com/CodePrometheus/Starry-RPC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodePrometheus/Starry-RPC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodePrometheus%2FStarry-RPC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodePrometheus%2FStarry-RPC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodePrometheus%2FStarry-RPC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodePrometheus%2FStarry-RPC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodePrometheus","download_url":"https://codeload.github.com/CodePrometheus/Starry-RPC/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodePrometheus%2FStarry-RPC/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T06:26:45.479Z","status":"ssl_error","status_checked_at":"2026-04-13T06:26:44.645Z","response_time":93,"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":["kyro","nacos","netty","rpc","zookeeper"],"created_at":"2024-11-12T18:09:48.899Z","updated_at":"2026-04-13T08:31:16.853Z","avatar_url":"https://github.com/CodePrometheus.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Starry-RPC\n\n🥚 设计一个功能较全的RPC框架\n\n🌾 特点如下\n\n- 基于BIO实现网络传输，运用原生Socket\n\n- 实现Kyro，Json，Hessian以及Protobuf序列化机制\n\n- 实现Gzip及Snappy对数据进行压缩\n\n- 自定义Netty通信协议，客户端与服务端通信协议重新设计，防止粘包\n\n- 实现客户端调用远程服务时进行的负载均衡，如一致性Hash，轮询及随机负载均衡\n\n- 使用Nacos，Zookeeper和Redis作为注册中心，管理相关服务地址信息\n\n- 使用CompletableFuture优化接受客户端返回结果，同时Netty重用Channel避免重复连接服务端\n\n- Netty心跳机制，保证客户端和服务端连接不被断掉，避免重连\n\n- 集成Spring通过注解进行注册服务，以及服务消费\n\n- 利用SPI的扩展机制\n\n- 增加服务版本号以及组号，处理一个接口有多个实现类的情况\n\n- 服务提供侧实现服务自动注册\n\n- 客户端重用相关服务地址信息列表\n\n- 容错机制，如快速失败、失败自动切换和安全失败\n\n- 自定义线程池拒绝策略\n\n\n\n\n## 传输协议\n\nStarry-RPC 协议\n\n~~~json\n* +---------------+---------------+-----------------+-------------+-------------+\n* |  Magic Number |  Package Type | Serializer Type |Compress Type| Data Length |\n* |    4 bytes    |    4 bytes    |     4 bytes     |   4 bytes   |   4 bytes   |\n* +---------------+---------------+-----------------+-------------+-------------+\n* |                                    Data Bytes                               |\n* |                                Length: ${Data Length}                       |\n* +-----------------------------------------------------------------------------+\n~~~\n\n|      字段       |                             解释                             |\n| :-------------: | :----------------------------------------------------------: |\n|  Magic Number   |         魔数，标识一个 Starr-RPC 协议包，0xCAFEBABE          |\n|  Package Type   |           包类型，标明这是一个调用请求还是调用响应           |\n| Serializer Type |          序列化器类型，标明这个包的数据的序列化方式          |\n|  Compress Type  |                           压缩类型                           |\n|   Data Length   |                        数据字节的长度                        |\n|   Data Bytes    | 传输的对象，通常是一个`RpcRequest`或`RpcClient`对象，取决于`Package Type`字段，对象的序列化方式取决于`Serializer Type`字段。 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeprometheus%2Fstarry-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeprometheus%2Fstarry-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeprometheus%2Fstarry-rpc/lists"}