Git Product home page Git Product logo

rpc's Introduction

rpc Build Status

This is a fork of the stdlib net/rpc which is frozen. It adds support for context.Context on the client and server, including propagating cancellation.

The API is exactly the same, except Client.Call takes a context.Context, and Server methods are expected to take a context.Context as the first argument. Additionally the wire protocol is unchanged, so is backwards compatible with net/rpc clients.

DialHTTPPathTimeout function is also added. A future release of rpc may update all Dial functions to instead take a context.

ClientTrace functionality is also added. This is for hooking into the rpc client to enable tracing.

Why use net/rpc

There are many alternatives for RPC in Go, the most popular being GRPC. However, net/rpc has the following nice properties:

  • Nice API
  • No need for IDL
  • Good performance

The nice API is subjective. However, the API is small, simple and composable. which makes it quite powerful. IDL tools are things like GRPC requiring protoc to generate go code from the protobuf files. net/rpc has no third party dependencies nor code generation step, simplify the use of it. A benchmark done on the 6 Sep 2016 indicated net/rpc was 4x faster than GRPC. This is an outdated benchmark, but is an indication at the surprisingly good performance net/rpc provides.

For more discussion on the pros and cons of net/rpc see the issue proposal: freeze net/rpc.

Details

Last forked from commit bfadd78986 on 7 September 2022.

Cancellation implemented via the rpc call _goRPC_.Cancel.

rpc's People

Contributors

javiermnieto avatar keegancsmith avatar nicksnyder avatar quasilyte avatar tooolbox avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.