You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Simon Ratner <si...@proxy.co> on 2016/07/30 20:07:19 UTC
Rationale for json as newtmgr protocol
Hi devs,
Wondering if there was a specific rationale for picking json as payload
serialization protocol for newtmgr?
Cheers,
simon
Re: Rationale for json as newtmgr protocol
Posted by Simon Ratner <si...@proxy.co>.
Thanks for explaining your selection process, exactly what I was looking
for.
My main concern right now is code size, JSON is heavy on string functions
which seem to require a decent chunk of code space, and that's before
throwing gzip into the mix. To be perfectly honest, I am not sure that
protobufs would be that much better, but at least some implementations like
nanopb look promising. Wonder if it's at least worth my time trying (and I
am saying this as someone who loves JSON for most things).
Totally agree regarding images; for moving raw bytes, binary chunks would
be more appropriate (and ¼ more efficient).
On Jul 31, 2016 10:42 AM, "Sterling Hughes" <st...@apache.org> wrote:
> Hi Simon,
>
> The newtmgr header itself is direct binary — it’s the command contents
> that are JSON. Newtmgr can accommodate other forms of encoding. For the
> command contents we looked at protobufs, json or direct binary:
>
> - direct binary, while most efficient, becomes difficult to maintain, for
> all the usual reasons: structure versioning/backwards compatibility, ease
> of introspection, etc.
>
> - protobufs are great, and (~10-15% more efficient, when you consider
> compression), however, in order to decode them, you require structure
> definitions to be shared on both ends.
>
> - whereas json is easy to define and introspect/share data. Our thought
> is that if we can make it work for BLE, then most other transports are
> going to be equivalent, or have more capacity.
>
> the Mynewt implementation of newtmgr is missing currently missing
> compression of JSON data, as we’ve focused more on correctness than
> efficiency. We should get a 40-50% efficiency win when we implement
> compression on the JSON data.
>
> we also may have to revisit the image upgrade commands with newtmgr. I
> think we may want to add an option to stream the image contents binary as
> well as JSON, to avoid having to base64 encode the image contents. having
> a chunked binary transfer mode would be useful, i think.
>
> Sterling
>
> On 30 Jul 2016, at 13:07, Simon Ratner wrote:
>
> Hi devs,
>>
>> Wondering if there was a specific rationale for picking json as payload
>> serialization protocol for newtmgr?
>>
>> Cheers,
>> simon
>>
>
Re: Rationale for json as newtmgr protocol
Posted by Sterling Hughes <st...@apache.org>.
Hi Simon,
The newtmgr header itself is direct binary \u2014 it\u2019s the command
contents that are JSON. Newtmgr can accommodate other forms of
encoding. For the command contents we looked at protobufs, json or
direct binary:
- direct binary, while most efficient, becomes difficult to maintain,
for all the usual reasons: structure versioning/backwards compatibility,
ease of introspection, etc.
- protobufs are great, and (~10-15% more efficient, when you consider
compression), however, in order to decode them, you require structure
definitions to be shared on both ends.
- whereas json is easy to define and introspect/share data. Our thought
is that if we can make it work for BLE, then most other transports are
going to be equivalent, or have more capacity.
the Mynewt implementation of newtmgr is missing currently missing
compression of JSON data, as we\u2019ve focused more on correctness than
efficiency. We should get a 40-50% efficiency win when we implement
compression on the JSON data.
we also may have to revisit the image upgrade commands with newtmgr. I
think we may want to add an option to stream the image contents binary
as well as JSON, to avoid having to base64 encode the image contents.
having a chunked binary transfer mode would be useful, i think.
Sterling
On 30 Jul 2016, at 13:07, Simon Ratner wrote:
> Hi devs,
>
> Wondering if there was a specific rationale for picking json as
> payload
> serialization protocol for newtmgr?
>
> Cheers,
> simon