A message payload format represents the data carried between services. Choose it with IPC efficiency, API usability, evolvability, and cross-language use in mind; some mechanisms, such as gRPC, dictate the format. section 8.1.6
Text and binary formats make different trade-offs:
- Text formats such as JSON and XML are readable and self-describing, helping consumers select values and tolerate many schema changes. They can be verbose and costly to parse, especially for large messages. section 8.1.6
- Binary formats such as Avro and Protocol Buffers are compact and fast to process, but require more tooling and are not human-readable. section 8.1 section 8.1.6
- Use cross-language formats rather than language-specific serialization. JSON Schema and XML Schema can document message structure and validate messages. section 8.1.6
Table 8.3 The benefits and drawbacks of text-based vs. binary formats for message payloads
|
Format |
Benefits |
Drawbacks |
|
Text |
|
|
|
Binary |
|
|
Compare the listed benefits and drawbacks of text and binary payload formats. section 8.1.6
