Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Build RPC Service for PHP
@廖祜秋liaohuqiu_淘宝无朽
• Why RPC
• How to design a RPC service
Content
• Implements
• Script: Easy to develop / deploy
• Life Cycle: safe to run, easy to code, easy to hire.
the Good
• Performance
• System status
the Bad
PHPRPC+
• ICE / Thrift / …
• YAF
Current solutions
• Network Protocol
• Serialize Protocol
Design RPC Service
• Message / RPC Protocol
• Exception / Log / Debug / Performanc...
Communication mechanism
half-duplex
• UDP
Network Protocol
• TCP
• JSON / MsgPack / BinPack vs Google PB
Serialize Protocol
• Simple data type vs Object
• Query
• Answer
• Close
• Welcome
Message & Call Flow
Message Header
Query Body
Answer Body
Data for exception
2015-08-27 12:24:43,692 DEBUG ('127.0.0.1', 33441): message received: proxy.Query((2, 'android-
gems', 'index_data', []))
...
2015-08-27 12:25:06,469 DEBUG ('127.0.0.1', 33452): reply answer:
proxy.Answer((3, 100, {'exception': 'MethodNotFound', 'c...
• Java
Implements
• Python:
• C++
• PHP
https://github.com/liaohuqiu/cube-rpc-python
Client only. https://github.com/liaoh...
Performance
• Python
• C++
• Java
Real world examples
Android Gems Top User
ATA
Q & A
Build RPC for PHP
Build RPC for PHP
Upcoming SlideShare
Loading in …5
×

of

Build RPC for PHP Slide 1 Build RPC for PHP Slide 2 Build RPC for PHP Slide 3 Build RPC for PHP Slide 4 Build RPC for PHP Slide 5 Build RPC for PHP Slide 6 Build RPC for PHP Slide 7 Build RPC for PHP Slide 8 Build RPC for PHP Slide 9 Build RPC for PHP Slide 10 Build RPC for PHP Slide 11 Build RPC for PHP Slide 12 Build RPC for PHP Slide 13 Build RPC for PHP Slide 14 Build RPC for PHP Slide 15 Build RPC for PHP Slide 16 Build RPC for PHP Slide 17 Build RPC for PHP Slide 18 Build RPC for PHP Slide 19 Build RPC for PHP Slide 20 Build RPC for PHP Slide 21 Build RPC for PHP Slide 22 Build RPC for PHP Slide 23 Build RPC for PHP Slide 24 Build RPC for PHP Slide 25
Upcoming SlideShare
Laravel - 系統全攻略
Next
Download to read offline and view in fullscreen.

1 Like

Share

Download to read offline

Build RPC for PHP

Download to read offline

Build RPC for PHP.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Build RPC for PHP

  1. 1. Build RPC Service for PHP @廖祜秋liaohuqiu_淘宝无朽
  2. 2. • Why RPC • How to design a RPC service Content • Implements
  3. 3. • Script: Easy to develop / deploy • Life Cycle: safe to run, easy to code, easy to hire. the Good
  4. 4. • Performance • System status the Bad
  5. 5. PHPRPC+
  6. 6. • ICE / Thrift / … • YAF Current solutions
  7. 7. • Network Protocol • Serialize Protocol Design RPC Service • Message / RPC Protocol • Exception / Log / Debug / Performance • Communication mechanism
  8. 8. Communication mechanism half-duplex
  9. 9. • UDP Network Protocol • TCP
  10. 10. • JSON / MsgPack / BinPack vs Google PB Serialize Protocol • Simple data type vs Object
  11. 11. • Query • Answer • Close • Welcome Message & Call Flow
  12. 12. Message Header
  13. 13. Query Body
  14. 14. Answer Body
  15. 15. Data for exception
  16. 16. 2015-08-27 12:24:43,692 DEBUG ('127.0.0.1', 33441): message received: proxy.Query((2, 'android- gems', 'index_data', [])) 2015-08-27 12:24:43,692 DEBUG handle_normal_servant: proxy.Query((2, 'android-gems', 'index_data', [])) 2015-08-27 12:24:43,692 DEBUG ('127.0.0.1', 33441): reply answer: proxy.Answer((2, 0, {'libs': [], 'un_review_count': 1, 'users': []})) 2015-08-27 12:24:43,723 DEBUG ('127.0.0.1', 33441): connection has been closed by client. 2015-08-27 12:24:43,723 DEBUG ('127.0.0.1', 33441): close connection 2015-08-27 12:24:43,723 DEBUG ('127.0.0.1', 33441): answer fiber stop Log
  17. 17. 2015-08-27 12:25:06,469 DEBUG ('127.0.0.1', 33452): reply answer: proxy.Answer((3, 100, {'exception': 'MethodNotFound', 'code': 1, 'raiser': u'android-gems@tcp:0.0.0.0:2099', 'message': u'servant android-gems do no have method index_data1 in adapter android- gems@tcp:0.0.0.0:2099'})) Exception log
  18. 18. • Java Implements • Python: • C++ • PHP https://github.com/liaohuqiu/cube-rpc-python Client only. https://github.com/liaohuqiu/cube-php Open source in process
  19. 19. Performance • Python • C++ • Java
  20. 20. Real world examples
  21. 21. Android Gems Top User
  22. 22. ATA
  23. 23. Q & A
  • AudiebantZhan

    Oct. 22, 2015

Build RPC for PHP.

Views

Total views

708

On Slideshare

0

From embeds

0

Number of embeds

5

Actions

Downloads

4

Shares

0

Comments

0

Likes

1

×