{"id":26567600,"url":"https://github.com/jauntsdn/rsocket-jvm","last_synced_at":"2025-03-22T19:19:52.688Z","repository":{"id":45444465,"uuid":"430616693","full_name":"jauntsdn/rsocket-jvm","owner":"jauntsdn","description":"Very fast GRPC-like \u0026 GRPC-compatible services on JVM with rich streaming model over multiple network transports","archived":false,"fork":false,"pushed_at":"2025-02-16T09:26:52.000Z","size":513,"stargazers_count":26,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-02-21T20:21:21.174Z","etag":null,"topics":["grpc","java","netty","rsocket"],"latest_commit_sha":null,"homepage":"https://jauntsdn.github.io","language":"Java","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/jauntsdn.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":"2021-11-22T08:09:08.000Z","updated_at":"2025-02-16T09:26:52.000Z","dependencies_parsed_at":"2023-11-21T18:28:40.985Z","dependency_job_id":"870f3680-384c-498b-a0b4-9f5a2eb4490b","html_url":"https://github.com/jauntsdn/rsocket-jvm","commit_stats":null,"previous_names":["jauntsdn/rsocket"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jauntsdn%2Frsocket-jvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jauntsdn%2Frsocket-jvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jauntsdn%2Frsocket-jvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jauntsdn%2Frsocket-jvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jauntsdn","download_url":"https://codeload.github.com/jauntsdn/rsocket-jvm/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245007974,"owners_count":20546256,"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":["grpc","java","netty","rsocket"],"created_at":"2025-03-22T19:19:52.063Z","updated_at":"2025-03-22T19:19:52.680Z","avatar_url":"https://github.com/jauntsdn.png","language":"Java","funding_links":[],"categories":["并发编程"],"sub_categories":[],"readme":"![Message-Streams](readme/mstreams.png)\n\n![Maven Central](https://img.shields.io/maven-central/v/com.jauntsdn.rsocket/rsocket-bom)\n[![Build](https://github.com/jauntsdn/rsocket-jvm/actions/workflows/ci-build.yml/badge.svg)](https://github.com/jauntsdn/rsocket-jvm/actions/workflows/ci-build.yml)\n\n# Message-Streams / RSocket-JVM\n\n![RSocket-JVM implementations](readme/impls_stripe.png)\n\nVery fast GRPC-like \u0026 GRPC-compatible services on JVM with rich streaming models over multiple data-center and internet transports [[1]](https://jauntsdn.github.io/mstreams/).\n\n## Summary\n\n\u003emultiple APIs: CompletableFuture or virtual threads; traditional streaming with GRPC-API (StreamObserver), or flavor of reactive: smallrye-mutiny, rxjava, reactor;\n\u003e \n\u003epluggable networking: TCP / UNIX / VM sockets; GRPC, websockets, websockets-over-http2, multiprotocol;\n\u003e \n\u003eservice APIs / RPC codegen stubs (Message-Streams) are decoupled from library runtime (RSocket-JVM, including network transports, load estimators, metrics);\n\u003e \n\u003etransparent origin (RPC) \u0026 proxy load estimation for cpu-efficient load balancers;\n\u003e \n\u003eoperates on hardware ranging from single board computers \u0026 mobile (2 cores / 32 MB heap) to cloud hosts (dozens of cores / 32+ GB heap).\n\n`RSocket-JVM` is [very fast](https://jauntsdn.github.io/post/rsocket-summary/) alternative (millions of messages per core with each interaction) to \nprojectreactor-only `RSocket/RSocket-java` from now-defunct \"Reactive Foundation\" -\nwhich is plagued by number of performance and security [problems](https://jauntsdn.github.io/post/rsocket-vs-spring/).\n\nRSocket is low latency/high throughput L5 network protocol intended for high-performance services communication. \nIt is transport agnostic, and runs on top of any reliable byte stream transport.\n\nThis repository hosts `Message-Streams` - API part of `RSocket-JVM`: suite of libraries for interprocess/network communication over \nmultiple transports using multiple APIs.  \n\n`Message-Streams` includes RPC: code-generation based remote procedure call system on top of Protocol Buffers.\n\n### CompletableFuture \u0026 virtual threads; GRPC StreamObserver; smallrye-mutiny, rxjava, project-reactor\n\n**Multiple vendor libraries**. [Shared protocol core](https://jauntsdn.github.io/post/rsocket-jvm/) with minimal dependencies \n(`netty-buffer` only) streamlines development process for each vendor implementation \u0026 reduces cost of maintenance of multiple libraries.\n\nProject supports 3 kinds of APIs: \n* request-response with RSocket-futures (JDK CompletableFuture) or virtual threads; \n* traditional streaming with RSocket-GRPC (GRPC-stubs StreamObserver); \n* flavors of reactive with RSocket-mutiny (smallrye-mutiny), RSocket-rxjava (rxjava3), and RSocket-reactor (project-reactor).\n\n**GRPC compatible**. All implementations are directly compatible with GRPC via `Message-Streams-RPC` \u0026 GRPC transport.\nGRPC clients can access such services without separate \"gateway\" binaries and IDL sharing schemes.\n \n**Non-intrusive**. [MessageStreams](https://github.com/jauntsdn/rsocket-jvm/blob/1.6.0/rsocket-reactor/src/main/java/com/jauntsdn/rsocket/MessageStreams.java) API \u0026 [RSocket-JVM](https://github.com/jauntsdn/rsocket-jvm/blob/1.6.0/rsocket-reactor/src/main/java/com/jauntsdn/rsocket/RSocket.java) runtime are clearly split so from end-user perspective there is \nonly set of streaming \u0026 non-streaming interactions on buffers/messages:\n\n**traditional streaming**\n```groovy\n  void requestResponse(Message message, StreamObserver\u003cMessage\u003e responseObserver); // one-to-one\n  void requestStream(Message message, StreamObserver\u003cMessage\u003e responseObserver);   // one-to-many \n  StreamObserver\u003cMessage\u003e requestChannel(StreamObserver\u003cMessage\u003e responseObserver);// many-to-many\n  void fireAndForget(Message message, StreamObserver\u003cMessage\u003e responseObserver);   // one-to-zero \n```\n\n**reactive streams**\n```groovy\n  Publisher\u003cMessage\u003e requestResponse(Message message);            // one-to-one\n  Publisher\u003cMessage\u003e requestStream(Message message);              // one-to-many\n  Publisher\u003cMessage\u003e requestChannel(Publisher\u003cMessage\u003e messages); // many-to-many\n  Publisher\u003cVoid\u003e fireAndForget(Message message);                 // one-to-zero\n```\n\n### RPC \n\n[MessageStreams-RPC](https://jauntsdn.github.io/post/rsocket-grpc/) is reflection-free, codegen based remote procedure call system \nrelying on single data format - protocol buffers. This combination opened many optimization opportunities and enabled \nGRPC interop via respective GRPC transport.\n\nEach vendor library has RPC module accompanied by compiler binary.\n\n### Multiple network transports\n\nNetwork transports are based on `Netty` only for compatibility with each vendor library, and are part of RSocket-JVM runtime.\n\nCurrently comprised of \n\n* `TCP`, `UNIX domain sockets` \u0026 `VM sockets` - known efficient byte stream protocols for datacenter / inter-process communication;\n\nand Http/Http2 based transports for interop:\n\n* `GRPC-RSocket-RPC` for communication with internet clients / external services;\n\n* `websocket` \u0026 `websocket-over-http2` for cross-cloud communication with Internet Standards transport;\n\n* `http/json` to expose auxiliary/control APIs as http endpoint;\n\n* `multiprotocol` transport to serve any combination of above over same port.\n\n### Examples\n\n[messagestreams-interop-examples](https://github.com/jauntsdn/messagestreams-grpc-interop-examples) demonstrate all implementations interop.\n\n[messagestreams-grpc-examples](https://github.com/jauntsdn/messagestreams-grpc-examples) demonstrate GRPC-stub StreamObserver based services.\n\n[messagestreams-virtualthreads-examples](https://github.com/jauntsdn/messagestreams-virtualthreads-examples) demonstrate jdk virtual threads based services.\n\n[messagestreams-futures-examples](https://github.com/jauntsdn/messagestreams-futures-examples) demonstrate jdk CompletableFuture based services.\n\n## Build\n\nRequires java20 if virtual threads modules are included (-Pvirtualthreads -Ptoolchains), java8-11 otherwise (depends on vendor library).\n\n```\n./gradlew\n```\n\nBuilding \u0026 installing artifacts into local maven repository\n```\n./gradlew clean build publishToMavenLocal\n```\n\n## Binaries\n\nBinary releases are published on MavenCentral: virtualthreads (RPC only), futures (CompletableFuture), grpc (GRPC-stub), reactor, rxjava, mutiny.\n\n```groovy\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation \"com.jauntsdn.rsocket:rsocket-messages:1.6.0\"\n    implementation \"com.jauntsdn.rsocket:rsocket-rpc-idl:1.6.0\"\n    implementation \"com.jauntsdn.rsocket:rsocket-\u003cVENDOR\u003e:1.6.0\"\n    implementation \"com.jauntsdn.rsocket:rsocket-rpc-\u003cVENDOR\u003e:1.6.0\"\n}\n```\n\nMessageStreams-RPC compiler binaries are linux, windows(x86) only\n```groovy\nprotobuf {\n     plugins {\n          rsocketRpc {\n              artifact = \"com.jauntsdn.rsocket:rsocket-rpc-\u003cVENDOR\u003e-compiler:1.6.0\"\n          }\n     }\n}\n```\n\n### Message streams. Design goals \u0026 scope\n\n**Fast transparent networking with practically useful set of streams libraries, for JVM based serverside, mobile \u0026 IOT applications**\n\nCurrently smallrye-mutiny, rxjava3, projectreactor; CompletableFutures (plus virtual threads); GRPC-stub (StreamObserver).\n\nLanguages and platforms other than JVM lack framework ecosystem (and most lack single reactive streams compatible library),\nso there are no substantial reasons for commitment.   \n\n**Message Streams**\n\nService APIs (Message-Streams plus RPC) and runtime (RSocket-JVM, transports) are explicitly separated so latter may be extended\nwithout affecting end-user application services, and services may be compiled separately from runtime.\n\n**Codegen based RPC on top of Protocol Buffers, compatible with GRPC** \n\nProtocol Buffers demonstrate acceptable performance with RSocket-JVM implementations, provide framework to extend \nits codegenerator for custom RPC system, and protobuf-java allows efficient usage of netty memory buffers. \n\nGRPC is dominant RPC based on Protocol Buffers over http2 for both server-side applications and mobile clients (except browsers) - \nsecond only after http REST APIs. It is supported on each commercially viable language/os/arch, so direct compatibility \nis essential.\n\n**Shared transports**\n\nTransports are shared, and considered part of runtime due to tight contract with RSocket-JVM for performance reasons. \nThis project offers strictly few highly optimized transports for interprocess/datacenter (TCP, UNIX sockets, VM sockets) \nand cross-datacenter/internet (GRPC, websocket, websocket-over-http2) communication, instead of user-friendly APIs for\nexternal implementors. This way if supported transports are extended or replaced, transport contract\nis free to change to accommodate new needs.   \n\n**Performance**\n\nRSocket-JVM is optimized for small messages \u003c 1KiB in size, typically 0.1 - 0.5 KiB: range covers common use cases\nfrom telemetry to social network chats. The goal is overwhelming throughput advantage \n(Message Streams + RPC, per cpu) over GRPC-java for additional latency \u003c 5 millis (typically ~1 ms) \nwith TCP transport, particularly request-response interaction ([comparison](https://jauntsdn.github.io/post/rsocket-vs-spring)). \nAdvantage \u003c 2x would probably make project non-competitive against GRPC due to new network software stack and different programming\nmodel (as in case of RSocket/RSocket-java from \"reactive foundation\" which somehow is even slower than GRPC-java on streaming interactions).\n\n## LICENSE\n\nCopyright 2020-Present Maksym Ostroverkhov.\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjauntsdn%2Frsocket-jvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjauntsdn%2Frsocket-jvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjauntsdn%2Frsocket-jvm/lists"}