Skip to content

Protocols

Sam Roberts edited this page Jun 17, 2015 · 2 revisions

Protocols

External Commenters

Cap'N Protocol

Update to Protocol Buffers, by one of its original authors.

Protocol Buffers

Looks like we could do an rpc-like (or even RESTy) protocol on top of pbufs streamed directly over tcp. Code size for dependencies would be very small, would have to write the C/Java directly ourselves.

nanopb

Doesn't use malloc, no dependencies, looks VERY memory efficient, and it's runtime is less than a thousand lines of code.

The price is that it's API can be a bit heavy going, you need a seperate callback function for every dynamically sized message member...

For example, support for the addressbook.proto tutorial example is almost unreadable as-is. In order to make it more friendly, you need to add a nanopb extension comment on strings to the .proto definition, and to other dynamically sized message members, giving maximum sizes, then it will create the fixed-size buffers in the struct for you. See http://koti.kapsi.fi/jpa/nanopb/docs/concepts.html for descriptions of max_size and max_count.

Interestingly, since protobuf encoding has internal size delimiting, it looks like it might be possible to stream them directly over TCP, or more reasonably, over SSL. This avoids the extra overhead of HTTP, or any other transport protocol.

Thrift

  • Home
  • Format: yes (various, including json)
  • Protocol: yes (but no C support)

Funny, its got lots of language support (D!), but no C support other than some incomplete support using glib (which is too heavy a dependency, I'm not porting glib to VxWorks!).

Probably good for data centre environment, don't see how porting it to VxWorks would be a good idea.

Avro

  • C docs
  • JSON or IDL (experimental) for protocol spec
  • minimal external dependencies for C
  • no C/C++ RPC support
  • schema is encapsulated with message. For dynamic languages this could make deploying new pieces a bit easier
  • has some sort of weird Avro-specific string representation

Looks like the message wire format is pretty simple, just a bunch of uin32 length/value pairs. However, the schema is also in the message, and maybe needs to be handled.

I think we could use this, but it would require some C-side work. If using Thrift was really compelling from the point of view of the rest of the system, we could get it working.

JSON-REST

I still like this idea.

I can use joyent's http-parser, do the sockets myself (or use libevent, maybe, if I can strip out some small part for just tcp handling), and use some kind of json lib (TBD on that).

C support:

REST

Java support:

C support:

Documenting JSON-REST APIs

It looks to me (SR) that using either JSON message examples, with inline comments, would be a decent way, maybe using docco to pull docs out.

Also, could use json schema files, with inline docs.

  • Twitter api documentation, an example of how to do it
  • enunciate, Java WS stuff.... useful?
  • iodocs, another generator of client-js for APIs, as well as node.js-side server stubs?
  • swagger
  • wadl and do we need it?
  • review of above, and more, with some discussion of various approaches
  • restdoc, another spec for machine readable rest api description, note the ref to node.js... maybe our server endpoints should use node.js? :-) especially simple aggregators... so many technologies, so many choices.

Also, maybe "spore"? https://github.com/agladysh/api-description

JSON-RPC

Not REST, but if we aren't using HTTP, REST is maybe not the way to go?

TIPC

Alternative to TCP, lots of cool features... we can't use it. Needs kernel support, and won't make it through firewalls. Sigh.

Zeugma was a heavy user, apparently.

SOAP/HTTP

VxWorks is supposed to support SOAP... the only saving grace of considering this.

Etch

Has some interesting features, like bi-directional communication.

C binding depends on apr, the Apache portable runtime. That's an unacceptably large dependency (even if it has been ported to VxWorks).

Eclipse TCF

TCF is a vendor-neutral, lightweight, extensible network protocol mainly for communicating with embedded systems (targets).

Initially, looked really promising, but after looking closer, it appears like this is for development tool support (thus, the involvement of the Eclipse foundation), it allows things like downloading images, getting stack traces, etc. Its not a run-time management protocol.

OPC-UA

Possible :-)

ICE

No support for C

MessagePack

Seems to be a binary equivalent of JSON - no IDL, no generated code, just binary representation of dict-like recursive data structues.

  • Java documentation is API only - no description
  • message-focused, not model focused
  • couldn't find docs on MessagePack-RPC
  • relatively simple

ActiveMQ

  • C support may be fairly rough
  • no JSON support