Protocol Buffers (Protobuf)
Google द्वारा विकसित एक भाषा-तटस्थ, प्लेटफ़ॉर्म-तटस्थ सीरियलाइज़ेशन फ्रेमवर्क। Protocol Buffers कुशल बाइनरी एन्कोडिंग और IDL-आधारित स्कीमा परिभाषा प्रदान करता है।
MIME Type
application/x-protobuf
प्रकार
बाइनरी
संपीड़न
दोषरहित
लाभ
- + 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
हानियाँ
- − Not human-readable — binary format requires tooling
- − Requires .proto schema definition and code generation step
- − Not suitable for human-edited configuration files
.PROTOBUF कब उपयोग करें
gRPC सर्विसेज़, माइक्रोसर्विस कम्युनिकेशन, मोबाइल ऐप API, IoT डिवाइस प्रोटोकॉल, और ऐसे सिस्टम जहाँ स्कीमा-ड्रिवन सीरियलाइज़ेशन और उच्च प्रदर्शन आवश्यक हो।
तकनीकी विवरण
.proto फ़ाइलें IDL (Interface Definition Language) में मैसेज स्ट्रक्चर परिभाषित करती हैं। protoc कम्पाइलर C++, Java, Python, Go आदि के लिए कोड जेनरेट करता है। बाइनरी wire format varint एन्कोडिंग और field tags (number + type) का उपयोग करता है। Proto3 डिफ़ॉल्ट वैल्यूज़ को सरल बनाता है।
इतिहास
Google ने 2001 में आंतरिक रूप से Protocol Buffers विकसित किया और 2008 में इसे ओपन-सोर्स किया। Proto2 और Proto3 (2016) संस्करण हैं। gRPC फ्रेमवर्क (2015) ने Protobuf को RPC सिस्टम्स में मानक बना दिया। Google की अधिकांश आंतरिक सेवाएँ Protobuf का उपयोग करती हैं।