{"id":37215896,"url":"https://github.com/nyan233/littlerpc","last_synced_at":"2026-01-15T00:58:10.525Z","repository":{"id":37564768,"uuid":"497391441","full_name":"nyan233/littlerpc","owner":"nyan233","description":"高性能/跨语言/轻量的玩具级RPC实现，致力提供高扩展性的API，您可以打造属于自己的RPC-Framework!","archived":false,"fork":false,"pushed_at":"2025-07-27T17:47:48.000Z","size":1144,"stargazers_count":47,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-27T19:32:48.643Z","etag":null,"topics":["chinese","go","golang","high-performance","rpc","rpc-client","rpc-framework","rpc-server"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nyan233.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":"2022-05-28T17:54:21.000Z","updated_at":"2025-07-27T17:47:52.000Z","dependencies_parsed_at":"2024-06-20T00:12:33.524Z","dependency_job_id":"a0fc65de-1664-47cd-b325-6494bb519d98","html_url":"https://github.com/nyan233/littlerpc","commit_stats":{"total_commits":395,"total_committers":2,"mean_commits":197.5,"dds":"0.38481012658227853","last_synced_commit":"0c8d5c48abaf79c2036ebf362a9b795f79402d72"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/nyan233/littlerpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyan233%2Flittlerpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyan233%2Flittlerpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyan233%2Flittlerpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyan233%2Flittlerpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nyan233","download_url":"https://codeload.github.com/nyan233/littlerpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyan233%2Flittlerpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28440986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"ssl_error","status_checked_at":"2026-01-15T00:55:20.945Z","response_time":107,"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":["chinese","go","golang","high-performance","rpc","rpc-client","rpc-framework","rpc-server"],"created_at":"2026-01-15T00:58:09.947Z","updated_at":"2026-01-15T00:58:10.503Z","avatar_url":"https://github.com/nyan233.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LittleRpc [![Go Report Card](https://goreportcard.com/badge/github.com/nyan233/littlerpc)](https://goreportcard.com/report/github.com/nyan233/littlerpc) [![Ci](https://github.com/nyan233/littlerpc/actions/workflows/ci.yml/badge.svg)](https://github.com/nyan233/littlerpc/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/nyan233/littlerpc/branch/main/graph/badge.svg?token=9S2QN667YY)](https://codecov.io/gh/nyan233/littlerpc) ![Go Version](https://img.shields.io/github/go-mod/go-version/nyan233/littlerpc) ![GitHub](https://img.shields.io/github/license/nyan233/littlerpc?color=fef\u0026label=License\u0026logo=fe\u0026logoColor=blue)\n\n高性能、轻量实现、少依赖、跨语言的玩具级RPC实现\n\n## Features\n\n- [x] 可替换的底层传输协议\n\t- [x] tcp\n\t- [x] webSocket\n\t- [x] other\n- [x] 可替换的序列化/反序列化组件\n\t- [x] json\n\t- [x] other\n- [x] 可替换的压缩算法\n\t- [x] gzip\n- [x] 调用描述接口\n\t- [x] Sync\n\t- [x] Async\n- [x] 负载均衡\n\t- [x] 地址列表解析器\n\t- [x] 轮询\n\t- [ ] 一致性Hash(问题很大，需要优化)\n- [ ] 客户端的实现\n\t- [x] go\n\t- [ ] java\n\t- [ ] javascript\n- [ ] 完善的服务治理拓展API\n\t- [ ] 熔断\n\t- [ ] 限流\n\t- [ ] 网关\n\t- [ ] 注册中心\n- [x] 完善可用的代码生成器\n\t- [x] 生成async api\n\t- [x] 生成sync api\n- [ ] 完善的示例\n\n## Benchmark\n\n基准测试的指标来自[rpcx-benchmark](https://github.com/rpcxio/rpcx-benchmark)，以下结果仅供参考，不同平台的结果可能会不一致，想要清晰的测量结果之前最好自己动手试一试\n\n`Platfrom`\n```shell\nServer\nCPU \t\t: AMD EPYC 7T83 16Core\nMemory  \t: 16GB * 4 ECC\nNetwork \t: 7.5G\nNumaNode\t: 0~0\n\nClient\nCPU \t\t: AMD EPYC 7T83 16Core\nMemory  \t: 16GB * 4 ECC\nNetwork \t: 7.5G\nNumaNode\t: 0~0\n```\n在测试中, `client`/`server`分别在一台机器上运行\n\n`Mock 10us`\n![result](https://raw.githubusercontent.com/zbh255/source/main/rpc-bench1.svg)\n## Install\n\n```go\ngo get github.com/nyan233/littlerpc\n```\n\n## Process-Defined\n\n在`littlerpc`中一个合法的过程是如下那样，必须有一个接收器，参数可以是指针类型或者非指针类型，返回结果集允许指针/非指针类型，返回值列表中最后的值类型必须是error\n\n`Type`的约束, 如上所说, 参数的类型可以是指针/非指针类型, 但是指针只不允许多重指针的出现, 另外参数不能为接口类型, 不管它是空接口还是非空接口, 除了`LittleRpc`能够理解的`context.Context`\u0026`stream.Stream`\u0026`error`\n\n```go\ntype Type interface {\n    Pointer(NoInterface) | NoPointer(NoInterface)\n}\n```\n\n```go\nfunc(receiver) FuncName(...Type) (...Type,error)\n```\n\n`littlerpc`并不规定合法的过程必须要传递参数，以下的声明也是合法的\n\n```go\nfunc(receiver) FuncName() (...Type,error)\n```\n\n`littlerpc`也不规定，一定要返回一个值，但是error必须在返回值列表中被声明，以下的声明也是合法的\n\n```go\nfunc(receiver) FuncName() error\n```\n\n关于`context.Context`\u0026`stream.Stream`, 输入参数可以有`context.Context`也可以没有`stream.Stream`同理, 如果有的话`context.Context`必须被放置在第一个参数的位置, 当它们同时存在时, `stream.Stream`必须被放置在第二个位置, 以下列出了参数的几种排列情况, `...`表示参数列表的长度为`0...N`\n\n- ```go\n\tfunc(receiver Type) FuncName(context.Context,...Type) (...result,error)\n\t```\n\n- ```go\n\tfunc(receiver Type) FuncName(context.Context,stream.Stream,...Type) (...Type,error)\n\t```\n\n- ```go\n\tfunc(receiver Type) FuncName(stream.Stream,...Type) (...Type,error)\n\t```\n\n- ```go\n\tfunc(receiver Type) FuncName(...Type) (...Type,error)\n\t```\n\n## LittleRpc-Utils\n\n### Code-Generator\n\n在编写每个客户端的代理对象时有很多繁琐的动作需要人工去完成，所以为了减轻这些不必要的工作，我提供了一个简易实现的代码生成器，自动生成代理对象和对应的过程。\n\n\u003e 代理对象生成器只会识别接收器类型为指针、拥有可导出名字（首字母大写）的过程，其它类型的过程均不会被生成器识别\n\n#### Install(安装)\n\n```shell\ngo install github.com/nyan233/littlerpc/cmd/pxtor\n```\n\n`LittleRpc-Example`中也使用了`pxtor`，这是其中的一个例子: [proxy](./example/proxy)\n\n### LittleRpc-Curl\n\n这是一个通过使用`LittleRpc`默认注册的`reflection service`来提供调试和调用测试的工具\n\n#### Install(安装)\n\n```sh\ngo install github.com/nyan233/littlerpc/cmd/lrpcurl\n```\n\n## Example\n\n### Quick-Start\n\n- [quick-start](./example/quick_start)\n- [hello-world](./example/hello_world)\n\n### Transport\n\n- `TCP`\n- `WebSocket`\n\n### Custom\n\n- `Codec`\n- `Encoder`\n\n### Balancer \u0026 Resolver\n\n- Todo\n\n## Thanks\n\n感谢，以下这些项目给本项目的一些设计带来了想法和灵感\n\n- [rpcx](https://github.com/smallnest/rpcx)\n- [grpc-go](https://github.com/grpc/grpc-go)\n- [std-rpc](https://github.com/golang/go/tree/master/src/net/rpc)\n\n## Lisence\n\nThe LittleRpc Use Mit licensed. More is See [Lisence](https://github.com/nyan233/littlerpc/blob/main/LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyan233%2Flittlerpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyan233%2Flittlerpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyan233%2Flittlerpc/lists"}