24
Introduction to Protocol Buffer

Introduction to protocol buffer

  • Upload
    tim-

  • View
    420

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Introduction to protocol buffer

Introduction to Protocol Buffer

Page 2: Introduction to protocol buffer

Outline

• Introduction

• Scenario

• Protocol Buffer Language

• Code Example

• conclusion

Page 3: Introduction to protocol buffer

Introduction

• Google

• IDL ( Schema )

Page 4: Introduction to protocol buffer

• XML 20 ~ 100

• 3 ~ 10

Page 5: Introduction to protocol buffer

Page 6: Introduction to protocol buffer

Page 7: Introduction to protocol buffer

• Parse, Serialization

Page 8: Introduction to protocol buffer

• Schema or No Schema

• Schema

Page 9: Introduction to protocol buffer

Protocol Buffer

• Schema

Page 10: Introduction to protocol buffer

?

• Google

• Twitter

• …

Page 11: Introduction to protocol buffer

2006 • http://bit.ly/1OG01PZ Google Java

• Google RPC Remote Procedure Call

Java Python C++

• Interface Definition LanguageJava Python C++

Page 12: Introduction to protocol buffer

Hadoop

• Restful api Query HBase protocol buffer

• Twitter hadoopProtocol Buffer

• Map Reduce YARN. mapper Reducer Protocol Buffer

Page 13: Introduction to protocol buffer

Tensor Flow

• Taipei.py Talk

• Tensor flow Graph

• Graph Protocol Buffer

Page 14: Introduction to protocol buffer

RTB( Real Time Bidding)

• Protocol Buffer

Page 15: Introduction to protocol buffer

• Web client side

Page 16: Introduction to protocol buffer

• ubuntu, mac

• IDL ( Schema )

• IDL , Schema

• Happy Coding

Page 17: Introduction to protocol buffer

Mac • brew install protobuf

• mkdir -p /Users/tim/.local/lib/python2.7/site-packages

• echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/tim/.local/lib/python2.7/site-packages/homebrew.pth

• pip

Page 18: Introduction to protocol buffer

IDL

message Person { required string name = 1; required int32 id = 2; optional string email = 3; }

Page 19: Introduction to protocol buffer

Compile

• protoc --python_out . sample.proto

• sample_pb2.py

Page 20: Introduction to protocol buffer

Usage

Page 21: Introduction to protocol buffer

deserialize

Page 22: Introduction to protocol buffer

Conclusion

• Protocol Buffer

Page 23: Introduction to protocol buffer

• CI. Schema

Page 24: Introduction to protocol buffer

Future

• Protocol Buffer 3

• RPC