Protocol Buffers (Protobuf)
Protocol Buffers (Protobuf) ist Googles sprachunabhängiges binäres Serialisierungsformat für effiziente Datenkommunikation zwischen Diensten. Es ist schneller und kompakter als JSON oder XML.
MIME-Typ
application/x-protobuf
Typ
Binaer
Komprimierung
Verlustfrei
Vorteile
- + 10-100x smaller and faster than JSON/XML
- + Schema-driven with generated type-safe code
- + Backward-compatible schema evolution via field numbers
- + Standard wire format for gRPC
Nachteile
- − Not human-readable — binary format requires tooling
- − Requires .proto schema definition and code generation step
- − Not suitable for human-edited configuration files
Wann Sie .PROTOBUF verwenden sollten
Verwenden Sie Protobuf für gRPC-Dienste, interne Microservice-Kommunikation und jede Anwendung, die schnellere und kompaktere Serialisierung als JSON benötigt.
Technische Details
Protobuf definiert Nachrichten in .proto-Dateien, die zu sprachspezifischem Code kompiliert werden. Die binäre Wire-Codierung verwendet Feld-Tags und Variable-Length-Integer für kompakte Darstellung.
Geschichte
Google entwickelte Protocol Buffers intern und veröffentlichte es 2008 als Open Source. Proto3 (2016) vereinfachte die Syntax und ist der aktuelle Standard.