Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace capnp with another protocol #11

Open
gavento opened this issue Mar 19, 2018 · 3 comments
Open

Replace capnp with another protocol #11

gavento opened this issue Mar 19, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@gavento
Copy link
Contributor

gavento commented Mar 19, 2018

While it currently serves reasonably well, Capnp has several drawbacks for Rain:

  • The interface and support for some languages is limited (e.g. no RPC for some, Pytohn API is very low-level).
    • No support in browser means we need REST(-like) API for monitoring anyway.
  • Compiling in some HPC environments may be an additional problem (may not improve with other solutions).
  • The message size is limited to 64MB (see Capnp message size caps limits one submit size #8) which makes large submits (and possibly other information calls) complicated.
  • We do not really need the advanced features of Capnp such as remote objects (these also need an additional packet to free even if they have no methods, see RPC: Avoid redundant finish packet when return carries no capabilities capnproto/capnproto#534).
    • The current capnp-rust sends every message in 2 packets - a further minor slowdown
    • However we do need bi-directional RPC calls, so no simple server/client RPC would do.

Therefore it might be better to use different protocols for different interfaces:

  • For client, low latency is not critical while portability and ease of use are, so it may make sense to have a REST API (or gRPC). The monitoring javascript app already uses REST for information.
    • It would be nice to leverage serde-json for the messages
    • API can be specified with a tool to generate code stubs and verifiers (like Apiary?)
  • For server-worker communication, it would be ergonomic to use serde, tarpc or possibly even abomonation with some simple framing.
  • For worker-subworker communication, it would be best to have some multi-platform and simple and yet fast protocol. Here the solution is less clear, but the communication schema is simpler (even if ideally with bi-directional messages).

This issue is a basis for discussion of requirements and options. The transition from Capnp is not critical.

@gavento gavento added the enhancement New feature or request label Mar 19, 2018
@gavento gavento self-assigned this Apr 12, 2018
@gavento
Copy link
Contributor Author

gavento commented Apr 13, 2018

For client connection, WebSockets with JSON-RPC 1.0 or a simiar custom protocol (based on json or message pack (MP) or CBOR)seem to be best option:

  • WS, JSON and message-pack are easily available (only competitor being Protobufs)
    • Unlike JSON, MP and CBOR support binary data and distinguish int/float numbers
    • In Rust we can use serde for Json, MP or CBOR, python has simple crates.
    • For WS in python there is aiohttp, in Rust probably rust-websocket
  • JSON and MP are (surprisingly) reasonably fast to parse (not being the bottleneck at the client side at least for now)
  • It would be nice to be able to stream notifications from server to client, as is available in JSON-RPC 1.0 and not in 2.0, but that may not be crucial and we may use MP-RPC or even make our own simple protocol.

This needs to be done before #38.

@gavento
Copy link
Contributor Author

gavento commented Jul 2, 2018

Partially resolved on v0.3: The governor-executor protocol has been switched to CBOR. The attributes are now transported as JSON even in capnp and remote object retrieval has been simplified, making future migration easier.

@gavento gavento closed this as completed Jul 2, 2018
@gavento
Copy link
Contributor Author

gavento commented Jul 2, 2018

Keeping open to track progress.

@gavento gavento reopened this Jul 2, 2018
@gavento gavento mentioned this issue Jul 2, 2018
15 tasks
@gavento gavento closed this as completed Jul 2, 2018
@gavento gavento reopened this Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant