{"id":13458732,"url":"https://github.com/Netflix/ribbon","last_synced_at":"2025-03-24T15:31:57.418Z","repository":{"id":6378634,"uuid":"7616158","full_name":"Netflix/ribbon","owner":"Netflix","description":"Ribbon is a Inter Process Communication (remote procedure calls) library with built in software load balancers. The primary usage model involves REST calls with various serialization scheme support.","archived":false,"fork":false,"pushed_at":"2024-12-10T21:18:08.000Z","size":3541,"stargazers_count":4595,"open_issues_count":217,"forks_count":1248,"subscribers_count":670,"default_branch":"master","last_synced_at":"2025-03-18T01:36:34.412Z","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/Netflix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-01-15T01:08:04.000Z","updated_at":"2025-03-16T07:29:34.000Z","dependencies_parsed_at":"2022-07-19T04:32:52.236Z","dependency_job_id":"7b3cf7f0-5d81-4514-9fcd-c9ffd1a6fee2","html_url":"https://github.com/Netflix/ribbon","commit_stats":{"total_commits":636,"total_committers":51,"mean_commits":"12.470588235294118","dds":0.5141509433962264,"last_synced_commit":"a634f1d5928f1a639aaab46b696f8ff1cf382f0e"},"previous_names":[],"tags_count":99,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fribbon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fribbon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fribbon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fribbon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Netflix","download_url":"https://codeload.github.com/Netflix/ribbon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245298174,"owners_count":20592555,"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-07-31T09:00:56.086Z","updated_at":"2025-03-24T15:31:52.408Z","avatar_url":"https://github.com/Netflix.png","language":"Java","readme":"Ribbon\n======\n\nRibbon is a client side IPC library that is battle-tested in cloud. It provides the following features\n\n* Load balancing\n* Fault tolerance\n* Multiple protocol (HTTP, TCP, UDP) support in an asynchronous and reactive model\n* Caching and batching\n\nTo get ribbon binaries, go to [maven central](http://search.maven.org/#search%7Cga%7C1%7Cribbon). Here is an example to add dependency in Maven:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.netflix.ribbon\u003c/groupId\u003e\n    \u003cartifactId\u003eribbon\u003c/artifactId\u003e\n    \u003cversion\u003e2.2.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Modules\n\n* ribbon: APIs that integrate load balancing, fault tolerance, caching/batching on top of other ribbon modules and [Hystrix](https://github.com/netflix/hystrix)\n* ribbon-loadbalancer: Load balancer APIs that can be used independently or with other modules\n* ribbon-eureka: APIs using [Eureka client](https://github.com/netflix/eureka) to provide dynamic server list for cloud\n* ribbon-transport: Transport clients that support HTTP, TCP and UDP protocols using [RxNetty](https://github.com/netflix/rxnetty) with load balancing capability\n* ribbon-httpclient: REST client built on top of Apache HttpClient integrated with load balancers (deprecated and being replaced by ribbon module)\n* ribbon-example: Examples\n* ribbon-core: Client configuration APIs and other shared APIs\n\n## Project Status: On Maintenance\nRibbon comprises of multiple components some of which are used in production internally and some of which were replaced by non-OSS solutions over time.\nThis is because Netflix started moving into a more componentized architecture for RPC with a focus on single-responsibility modules. So each Ribbon component gets a different level of attention at this moment.\n\nMore specifically, here are the components of Ribbon and their level of attention by our teams:\n* ribbon-core: **deployed at scale in production**\n* ribbon-eureka: **deployed at scale in production**\n* ribbon-evcache: **not used**\n* ribbon-guice: **not used**\n* ribbon-httpclient: **we use everything not under com.netflix.http4.ssl.\n                       Instead, we use an internal solution developed by our cloud security team**\n* ribbon-loadbalancer: **deployed at scale in production**\n* ribbon-test: **this is just an internal integration test suite**\n* ribbon-transport: **not used**\n* ribbon: **not used**\n\nEven for the components deployed in production we have wrapped them in a Netflix internal http client and we are not adding new functionality since they’ve been stable for a while.\n Any new functionality has been added to internal wrappers on top of Ribbon (such as request tracing and metrics). We have not made an effort to make those components Netflix-agnostic under Ribbon.\n\nRecognizing these realities and deficiencies, we are placing Ribbon in maintenance mode.\nThis means that if an external user submits a large feature request, internally we wouldn’t prioritize it highly.\nHowever, if someone were to do work on their own and submit complete pull requests, we’d be happy to review and accept.\nOur team has instead started building an RPC solution on top of gRPC.\nWe are doing this transition for two main reasons: multi-language support and better extensibility/composability through request interceptors.\nThat’s our current plan moving forward.\n\nWe currently contribute to the gRPC code base regularly.\nTo help our teams migrate to a gRPC-based solution in production (and battle-test it),\nwe are also adding load-balancing and discovery interceptors to achieve feature parity with the functionality Ribbon and Eureka provide.\nThe interceptors are Netflix-internal at the moment. When we reach that level of confidence we hope to open-source this new approach.\nWe don’t expect this to happen before Q3 of 2016.\n\n## Release notes\n\nSee https://github.com/Netflix/ribbon/releases\n\n## Code example\n\n### Access HTTP resource using template ([full example](https://github.com/Netflix/ribbon/blob/master/ribbon-examples/src/main/java/com/netflix/ribbon/examples/rx/template/RxMovieTemplateExample.java))\n\n```java\nHttpResourceGroup httpResourceGroup = Ribbon.createHttpResourceGroup(\"movieServiceClient\",\n            ClientOptions.create()\n                    .withMaxAutoRetriesNextServer(3)\n                    .withConfigurationBasedServerList(\"localhost:8080,localhost:8088\"));\nHttpRequestTemplate\u003cByteBuf\u003e recommendationsByUserIdTemplate = httpResourceGroup.newTemplateBuilder(\"recommendationsByUserId\", ByteBuf.class)\n            .withMethod(\"GET\")\n            .withUriTemplate(\"/users/{userId}/recommendations\")\n            .withFallbackProvider(new RecommendationServiceFallbackHandler())\n            .withResponseValidator(new RecommendationServiceResponseValidator())\n            .build();\nObservable\u003cByteBuf\u003e result = recommendationsByUserIdTemplate.requestBuilder()\n                        .withRequestProperty(\"userId\", \"user1\")\n                        .build()\n                        .observe();\n```\n\n### Access HTTP resource using annotations ([full example](https://github.com/Netflix/ribbon/blob/master/ribbon-examples/src/main/java/com/netflix/ribbon/examples/rx/proxy/RxMovieProxyExample.java))\n\n```java\npublic interface MovieService {\n    @Http(\n            method = HttpMethod.GET,\n            uri = \"/users/{userId}/recommendations\",\n            )\n    RibbonRequest\u003cByteBuf\u003e recommendationsByUserId(@Var(\"userId\") String userId);\n}\n\nMovieService movieService = Ribbon.from(MovieService.class);\nObservable\u003cByteBuf\u003e result = movieService.recommendationsByUserId(\"user1\").observe();\n```\n\n### Create an AWS-ready load balancer with [Eureka](https://github.com/Netflix/eureka) dynamic server list and zone affinity enabled\n\n```java\n        IRule rule = new AvailabilityFilteringRule();\n        ServerList\u003cDiscoveryEnabledServer\u003e list = new DiscoveryEnabledNIWSServerList(\"MyVIP:7001\");\n        ServerListFilter\u003cDiscoveryEnabledServer\u003e filter = new ZoneAffinityServerListFilter\u003cDiscoveryEnabledServer\u003e();\n        ZoneAwareLoadBalancer\u003cDiscoveryEnabledServer\u003e lb = LoadBalancerBuilder.\u003cDiscoveryEnabledServer\u003enewBuilder()\n                .withDynamicServerList(list)\n                .withRule(rule)\n                .withServerListFilter(filter)\n                .buildDynamicServerListLoadBalancer();   \n        DiscoveryEnabledServer server = lb.chooseServer();         \n```\n\n### Use LoadBalancerCommand to load balancing IPC calls made by HttpURLConnection ([full example](https://github.com/Netflix/ribbon/blob/master/ribbon-examples/src/main/java/com/netflix/ribbon/examples/loadbalancer/URLConnectionLoadBalancer.java))\n\n```java\nCommandBuilder.\u003cString\u003enewBuilder()\n        .withLoadBalancer(LoadBalancerBuilder.newBuilder().buildFixedServerListLoadBalancer(serverList))\n        .build(new LoadBalancerExecutable\u003cString\u003e() {\n            @Override\n            public String run(Server server) throws Exception {\n                URL url = new URL(\"http://\" + server.getHost() + \":\" + server.getPort() + path);\n                HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n                return conn.getResponseMessage();\n            }\n        }).execute();\n```\n\n## License\n\nCopyright 2014 Netflix, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n## Questions?\n\nEmail ribbon-users@googlegroups.com or [join us](https://groups.google.com/forum/#!forum/ribbon-users)\n\n\n","funding_links":[],"categories":["Java","Projects","Orchestration \u0026 Management","项目","Load Balancing \u0026 Ingress","Load Balancer","I. Development","常用框架\\\u0026第三方库","Open Source Repos","容错组件","\u003ca name=\"Java\"\u003e\u003c/a\u003eJava"],"sub_categories":["HTTP Clients","HTTP客户端","Client-side","2. Web development","Miscellaneous Repos"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Fribbon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNetflix%2Fribbon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Fribbon/lists"}