Norpc: A framework for in-process microservices

I released a framework for in-process microservices on Tokio runtime.

The difference between a previous work tarpc is that

  1. norpc only supports in-process microservices because I think gRPC should be used for the purpose of networking RPC. The name norpc comes from "not remote procedure call".
  2. norpc depends on tower::Service abstraction to exploits the assets in the ecosystem.
  3. norpc supports !Send futures.
  4. norpc is about 50% less overhead than tarpc.

Regarding 2, you can exploit any tower middleware on both client/server sides. Here is the example.

    tokio::spawn(async move {
        let app = RateLimitApp;
        let service = RateLimitService::new(app);
        let service = ServiceBuilder::new()
            .rate_limit(5000, std::time::Duration::from_secs(1))
            .service(service);
        let server = norpc::ServerChannel::new(rx, service);
        server.serve().await
    });

Regarding 3, you can even define non-Send service to work tasks in a single thread.

#[norpc::service(?Send)]
trait HelloWorld {
    fn hello(s: Rc<String>) -> Rc<String>;
}

(updated as of 0.5.1)

2 Likes