...
The data modeler supports generating objects with 3 diffferent ecodings, Json, Protobuf and Xbuf. From an API perspective the generated interfaces are functionally equivalend (with a few exceptions), but each encoding has different performance characteristics that are described in the sections below.
Json
With json encoding fairly simple classes are created that use jackson for serializing to/from json. It is suitable for lightweight applications or for applications that natively work with json (e.g. web applications).
...
- Jackson serialization is slow and produces a lot of garbage, and json objects can't be pooled.
- Serializing to text is not very compact which leads to higher disk usage and network bandwidth.
Note also that all encoding types allow a message to be serialized to or from json as a secondary functionality.
...
With protobuf endoding objects are create with backing google protobuf generated objects. Protobuf is suitable for applications with higher performance requirements than is afforded by Json encoding. It should be used by applications with moderate to high performance requirements.
Tip |
---|
Protobuf is recommended for generating ADM objects used for application state. |
Pros:
- Memory Utilization: Protobuf generated objects are fairly compact in memory compared to Xbuf objects, non repeated field values are store directly in the generated message object, making protobuf encoded objects a good candidate for usage as state entities.
- Faster serialization than Json.
- Protobuf is a well known standard, making it easy to interoperate with applications not uses ADM generated code.
- Supports serialization / from json.
...
Xbuf generated objects, are backed by the X Platform's high performance implementation of Google protobufs which supports zero garbage operation and cut-through serialization (the ability to read/write fields directly to from a backing buffer). It should be used for applications with the most stringent performance requirements.
Tip |
---|
Xbuf is recommended for use with ADM message models particularly for applications that require very low latency. |
Pros:
- Faster serialization than Json or Protobuf
- Protobuf is a well known standard, making it easy to interoperate with applications not uses ADM generated code.
- Compatible with protobuf on the wire.
- When not interoperating with google protobuf generated recipients, code can also be generated to perform even faster.
...