from Hacker News

Writing an RPC from Scratch (2021)

by otras on 5/2/23, 3:19 AM with 15 comments

  • by eska on 5/2/23, 11:27 AM

    This looks more like a socket tutorial than rpc. It leaves out most aspects about implementing rpc that are actually interesting.
  • by JonChesterfield on 5/2/23, 6:20 AM

    Ignores failure modes. The is_prime example takes an integer to a bool, and is put on the far side of a network call, but there's no change to the interface to indicate network failures and no fallback path to compute it locally if things go wrong.

    (strictly it calls exit on anything going wrong, but as the whole problem with rpc is the extra failure modes that's not compelling)

  • by butterisgood on 5/2/23, 10:47 AM

    The whole “network order” of bytes thing is not a given. There’s little endian “network orderings”.

    And now it seems most CPUs are little endian anyway, so why do this conversion anymore to “network order” if you are designing a new protocol?

  • by segfaltnh on 5/2/23, 11:19 AM

    Great intro for more junior devs learning how it all comes together. It's incredibly easy to use these things without understanding what they are doing for you under the hood.