SlideShare a Scribd company logo
1 of 23
Tho Luong 
SILILAB Vietnam 
Hanoi, March 1, 2014 
Rubichat
Introduction 
2 
 Rubichat: 
 A Realtime Communication Service 
 Allow website owner to communicate with customer 
more easily
Rubichat: customer & operator 
3
Introduction 
4 
 Rubichat: 
 A Realtime Communication Service 
 Allow website owner to communicate with customer 
more easily 
 Easy to setup:
Architecture 
X user Facebook user Customer and operator 
X1 X2 crane crane 
RabbitMQ 
tractor tractor 
Java, php, spring, hibernate, amqp, 
nodejs, zend framework, netty 
sensor Apache 
? 
MySQL, Redis and MongoDB
Issue 
6 
 Develop rubiweb project in PHP using Zend 
Framework 
 Some services were implemented in Java (30%) 
 Should we implement other services in Java or PHP 
or both of them? 
 3 solutions
Solution #1 
7 
 Reimplement all services in PHP 
 Some services will be implemented in both Java 
and PHP  not a big problem 
 PHP and Zend work well with MySQL, do they 
still work well with MongoDB and Redis? 
 Just some services use MongoDB and Redis 
 not a big problem
Solution #1 
8 
 When Java wants to use a service that is 
implemented in PHP  port this implementation to 
Java? 
 Some services are hard to implement, ex: access 
control service 
Solution #1: complicated and not easy for 
maintainance.
Solution #2 
9 
 Beauty and maintainability are #1 priority 
 All services will be implemented in Java 
 PHP calls Java service implementations remotely 
via RabbitMQ 
e2 
PHP Java 
e1 
req 
resp 
OK
Solution #2 
10 
 Problem: how to receive response properly? 
PHP -01 
PHP-02 
Resp-01 
Resp-02 
 Mission impossible
Solution #2 
11 
 How about using one queue for each PHP request? 
PHP-01 
PHP-02 
….. ….. e 
PHP-n 
 At least, one “dirty” queue is produced after each 
PHP request lifecycle 
No, RabbitMQ must manage a lot of queues.
Solution #3 
12 
 RPC: PHP invokes Java API remotely 
PHP 
Java 
Server 
X protocol 
 Issues: 
1. System architecture 
2. Protocol selection 
Flappy 
3. Technology selections for Java Server
System architecture 
13 
 Option 1: flappy accesses database directly 
PHP 
Java 
Server 
X protocol 
Flappy 
MySQ 
L 
Mong 
oDB 
Redis 
 Option 2: flappy serves PHP connections, access 
service implentations via RabbitMQ 
PHP 
Java 
Server 
Flappy 
RabbitMQ 
MySQ 
L 
Mong 
oDB 
Redis 
Tractor 
Tractor 
….. 
…..
Protocol selection 
14 
 Common RPC protocols 
 XML RPC 
 JSON RPC 
 Protobuf (google) 
 Thrift (facebook) 
 SOAP 
 Flappy uses XMPP (RFC 3920,RFC 3921) message 
format 
 Easy to control 
 Familiar to Rubichat developers
XMPP in JSON format 
15 
 Stanza: IQ 
 Stanza: M
Binary data format 
16 
 Data type: 1 byte 
 RABBIT_TRACTOR_IN, 
RABBIT_TRACTOR_OUT, FLAPPY_IN, 
FLAPPY_OUT, NA 
 Length: int: 4 byte 
 Body 
type length body 
1 4 length
Technologies selection 
17 
 Socket library: Netty, a great library for network 
application 
 Twitter uses Netty to improve search engine 
performance. (3x faster) 
 Interceptor design in Tractor server is influenced by 
Netty
Netty advantages 
18 
 Asynchronous I/O: decouple threads from Client 
Socket Connections 
 Rich Buffer data structure 
 Advanced Components for More Rapid 
Development 
 Event Model based on the Interceptor Chain 
Pattern
Test result 
19 
 Create 100 users, find them and measure time: 
Service Query Tractor(ms) Client (ms) Δ (ms) 
Create 100 5196 5665 469 
Find 1 187 203 16 
Service Query Tractor(ms) Client (ms) Δ (ms) 
Create 100 4414 
Find 1 34 
(New FlappyClient implementation: use single connection(March 26, 2014))
20 
Demo: 
1. Flappy Server 
2. Tractor
Solution disadvantages 
21 
response 
PHP 
Java Server 
Flappy 
.phpModel 
ToJSON() 
request 
.jsonTo 
PhpModel() 
.jsonTo 
JavaModel() 
.javaModel 
ToJSON() 
 Write data-mappers 
manually
Future work 
22 
 Tool for generating data mappers 
 Optimize PHP FlappyClient and develop clients for 
other languages
Thank you! 
23

More Related Content

What's hot

Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQNahidul Kibria
 
Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsRick Hightower
 
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
Reaching 5 Million Messaging Connections:  Our Journey with KubernetesReaching 5 Million Messaging Connections:  Our Journey with Kubernetes
Reaching 5 Million Messaging Connections: Our Journey with KubernetesConnected
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQAll Things Open
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQKnoldus Inc.
 
VerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerVerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerAdriano Pimpini
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsHoucheng Lin
 
RabbitMQ fairly-indepth
RabbitMQ fairly-indepthRabbitMQ fairly-indepth
RabbitMQ fairly-indepthWee Keat Chin
 
An update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael KlishinAn update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael KlishinRabbitMQ Summit
 
Introduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQIntroduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQDmitriy Samovskiy
 
Commication Framework in OpenStack
Commication Framework in OpenStackCommication Framework in OpenStack
Commication Framework in OpenStackSean Chang
 
Modern Distributed Messaging and RPC
Modern Distributed Messaging and RPCModern Distributed Messaging and RPC
Modern Distributed Messaging and RPCMax Alexejev
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPCGuo Jing
 
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...Igalia
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009Paolo Negri
 

What's hot (20)

Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQ
 
Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoops
 
Ad Server Optimization
Ad Server OptimizationAd Server Optimization
Ad Server Optimization
 
Message Broker System and RabbitMQ
Message Broker System and RabbitMQMessage Broker System and RabbitMQ
Message Broker System and RabbitMQ
 
AMQP with RabbitMQ
AMQP with RabbitMQAMQP with RabbitMQ
AMQP with RabbitMQ
 
Amqp Basic
Amqp BasicAmqp Basic
Amqp Basic
 
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
Reaching 5 Million Messaging Connections:  Our Journey with KubernetesReaching 5 Million Messaging Connections:  Our Journey with Kubernetes
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQ
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
 
VerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerVerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT Broker
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example Applications
 
RabbitMQ fairly-indepth
RabbitMQ fairly-indepthRabbitMQ fairly-indepth
RabbitMQ fairly-indepth
 
An update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael KlishinAn update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael Klishin
 
Introduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQIntroduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQ
 
Commication Framework in OpenStack
Commication Framework in OpenStackCommication Framework in OpenStack
Commication Framework in OpenStack
 
Modern Distributed Messaging and RPC
Modern Distributed Messaging and RPCModern Distributed Messaging and RPC
Modern Distributed Messaging and RPC
 
HTTP/2 Server Push
HTTP/2 Server PushHTTP/2 Server Push
HTTP/2 Server Push
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
 
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009
 

Viewers also liked

Netflix at-disney-09-26-2014
Netflix at-disney-09-26-2014Netflix at-disney-09-26-2014
Netflix at-disney-09-26-2014Monal Daxini
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)Peter Lubbers
 
JSON-RPC - JSON Remote Procedure Call
JSON-RPC - JSON Remote Procedure CallJSON-RPC - JSON Remote Procedure Call
JSON-RPC - JSON Remote Procedure CallPeter R. Egli
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryTechFerry
 
Measuring CDN performance and why you're doing it wrong
Measuring CDN performance and why you're doing it wrongMeasuring CDN performance and why you're doing it wrong
Measuring CDN performance and why you're doing it wrongFastly
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with nettyZauber
 
Trends in Sensors, Wearable Devices and IoT
Trends in Sensors, Wearable Devices and IoTTrends in Sensors, Wearable Devices and IoT
Trends in Sensors, Wearable Devices and IoTWalt Maclay
 
REST vs. Messaging For Microservices
REST vs. Messaging For MicroservicesREST vs. Messaging For Microservices
REST vs. Messaging For MicroservicesEberhard Wolff
 

Viewers also liked (8)

Netflix at-disney-09-26-2014
Netflix at-disney-09-26-2014Netflix at-disney-09-26-2014
Netflix at-disney-09-26-2014
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
 
JSON-RPC - JSON Remote Procedure Call
JSON-RPC - JSON Remote Procedure CallJSON-RPC - JSON Remote Procedure Call
JSON-RPC - JSON Remote Procedure Call
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerry
 
Measuring CDN performance and why you're doing it wrong
Measuring CDN performance and why you're doing it wrongMeasuring CDN performance and why you're doing it wrong
Measuring CDN performance and why you're doing it wrong
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with netty
 
Trends in Sensors, Wearable Devices and IoT
Trends in Sensors, Wearable Devices and IoTTrends in Sensors, Wearable Devices and IoT
Trends in Sensors, Wearable Devices and IoT
 
REST vs. Messaging For Microservices
REST vs. Messaging For MicroservicesREST vs. Messaging For Microservices
REST vs. Messaging For Microservices
 

Similar to Using RabbitMQ and Netty library to implement RPC protocol

Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPMax Romanovsky
 
Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)Viktor Turskyi
 
Node Summit 2016: Web App Architectures
Node Summit 2016:  Web App ArchitecturesNode Summit 2016:  Web App Architectures
Node Summit 2016: Web App ArchitecturesChris Bailey
 
High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017Rick Hightower
 
Building a web application with ontinuation monads
Building a web application with ontinuation monadsBuilding a web application with ontinuation monads
Building a web application with ontinuation monadsSeitaro Yuuki
 
Cytoscape CI Chapter 2
Cytoscape CI Chapter 2Cytoscape CI Chapter 2
Cytoscape CI Chapter 2bdemchak
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceEvan McGee
 
Massaging the Pony: Message Queues and You
Massaging the Pony: Message Queues and YouMassaging the Pony: Message Queues and You
Massaging the Pony: Message Queues and YouShawn Rider
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornMaxime Najim
 
High-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulationsHigh-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulationsRick Hightower
 
Cosenza_MuleSoft_Meetup_1st.pptx
Cosenza_MuleSoft_Meetup_1st.pptxCosenza_MuleSoft_Meetup_1st.pptx
Cosenza_MuleSoft_Meetup_1st.pptxAndreaCapolei2
 
How do async ap is survive in a rest world
How do async ap is survive in a rest world How do async ap is survive in a rest world
How do async ap is survive in a rest world Luca Mattia Ferrari
 
Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?Nordic APIs
 
Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?LaunchAny
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupMickaël Rémond
 
How Browser and server works
How Browser and server worksHow Browser and server works
How Browser and server worksWeb Developer
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays
 
Microservices summit talk 1/31
Microservices summit talk   1/31Microservices summit talk   1/31
Microservices summit talk 1/31Varun Talwar
 
MuleSoft_Meetup_Datagraph and Async APIs.pptx.pdf
MuleSoft_Meetup_Datagraph and Async APIs.pptx.pdfMuleSoft_Meetup_Datagraph and Async APIs.pptx.pdf
MuleSoft_Meetup_Datagraph and Async APIs.pptx.pdfVikalp Bhalia
 

Similar to Using RabbitMQ and Netty library to implement RPC protocol (20)

Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHP
 
Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)
 
Node Summit 2016: Web App Architectures
Node Summit 2016:  Web App ArchitecturesNode Summit 2016:  Web App Architectures
Node Summit 2016: Web App Architectures
 
Websocket 101 in Python
Websocket 101 in PythonWebsocket 101 in Python
Websocket 101 in Python
 
High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017
 
Building a web application with ontinuation monads
Building a web application with ontinuation monadsBuilding a web application with ontinuation monads
Building a web application with ontinuation monads
 
Cytoscape CI Chapter 2
Cytoscape CI Chapter 2Cytoscape CI Chapter 2
Cytoscape CI Chapter 2
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
 
Massaging the Pony: Message Queues and You
Massaging the Pony: Message Queues and YouMassaging the Pony: Message Queues and You
Massaging the Pony: Message Queues and You
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with Nashorn
 
High-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulationsHigh-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulations
 
Cosenza_MuleSoft_Meetup_1st.pptx
Cosenza_MuleSoft_Meetup_1st.pptxCosenza_MuleSoft_Meetup_1st.pptx
Cosenza_MuleSoft_Meetup_1st.pptx
 
How do async ap is survive in a rest world
How do async ap is survive in a rest world How do async ap is survive in a rest world
How do async ap is survive in a rest world
 
Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?
 
Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF Meetup
 
How Browser and server works
How Browser and server worksHow Browser and server works
How Browser and server works
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
Microservices summit talk 1/31
Microservices summit talk   1/31Microservices summit talk   1/31
Microservices summit talk 1/31
 
MuleSoft_Meetup_Datagraph and Async APIs.pptx.pdf
MuleSoft_Meetup_Datagraph and Async APIs.pptx.pdfMuleSoft_Meetup_Datagraph and Async APIs.pptx.pdf
MuleSoft_Meetup_Datagraph and Async APIs.pptx.pdf
 

Recently uploaded

SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 

Recently uploaded (20)

SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 

Using RabbitMQ and Netty library to implement RPC protocol

  • 1. Tho Luong SILILAB Vietnam Hanoi, March 1, 2014 Rubichat
  • 2. Introduction 2  Rubichat:  A Realtime Communication Service  Allow website owner to communicate with customer more easily
  • 3. Rubichat: customer & operator 3
  • 4. Introduction 4  Rubichat:  A Realtime Communication Service  Allow website owner to communicate with customer more easily  Easy to setup:
  • 5. Architecture X user Facebook user Customer and operator X1 X2 crane crane RabbitMQ tractor tractor Java, php, spring, hibernate, amqp, nodejs, zend framework, netty sensor Apache ? MySQL, Redis and MongoDB
  • 6. Issue 6  Develop rubiweb project in PHP using Zend Framework  Some services were implemented in Java (30%)  Should we implement other services in Java or PHP or both of them?  3 solutions
  • 7. Solution #1 7  Reimplement all services in PHP  Some services will be implemented in both Java and PHP  not a big problem  PHP and Zend work well with MySQL, do they still work well with MongoDB and Redis?  Just some services use MongoDB and Redis  not a big problem
  • 8. Solution #1 8  When Java wants to use a service that is implemented in PHP  port this implementation to Java?  Some services are hard to implement, ex: access control service Solution #1: complicated and not easy for maintainance.
  • 9. Solution #2 9  Beauty and maintainability are #1 priority  All services will be implemented in Java  PHP calls Java service implementations remotely via RabbitMQ e2 PHP Java e1 req resp OK
  • 10. Solution #2 10  Problem: how to receive response properly? PHP -01 PHP-02 Resp-01 Resp-02  Mission impossible
  • 11. Solution #2 11  How about using one queue for each PHP request? PHP-01 PHP-02 ….. ….. e PHP-n  At least, one “dirty” queue is produced after each PHP request lifecycle No, RabbitMQ must manage a lot of queues.
  • 12. Solution #3 12  RPC: PHP invokes Java API remotely PHP Java Server X protocol  Issues: 1. System architecture 2. Protocol selection Flappy 3. Technology selections for Java Server
  • 13. System architecture 13  Option 1: flappy accesses database directly PHP Java Server X protocol Flappy MySQ L Mong oDB Redis  Option 2: flappy serves PHP connections, access service implentations via RabbitMQ PHP Java Server Flappy RabbitMQ MySQ L Mong oDB Redis Tractor Tractor ….. …..
  • 14. Protocol selection 14  Common RPC protocols  XML RPC  JSON RPC  Protobuf (google)  Thrift (facebook)  SOAP  Flappy uses XMPP (RFC 3920,RFC 3921) message format  Easy to control  Familiar to Rubichat developers
  • 15. XMPP in JSON format 15  Stanza: IQ  Stanza: M
  • 16. Binary data format 16  Data type: 1 byte  RABBIT_TRACTOR_IN, RABBIT_TRACTOR_OUT, FLAPPY_IN, FLAPPY_OUT, NA  Length: int: 4 byte  Body type length body 1 4 length
  • 17. Technologies selection 17  Socket library: Netty, a great library for network application  Twitter uses Netty to improve search engine performance. (3x faster)  Interceptor design in Tractor server is influenced by Netty
  • 18. Netty advantages 18  Asynchronous I/O: decouple threads from Client Socket Connections  Rich Buffer data structure  Advanced Components for More Rapid Development  Event Model based on the Interceptor Chain Pattern
  • 19. Test result 19  Create 100 users, find them and measure time: Service Query Tractor(ms) Client (ms) Δ (ms) Create 100 5196 5665 469 Find 1 187 203 16 Service Query Tractor(ms) Client (ms) Δ (ms) Create 100 4414 Find 1 34 (New FlappyClient implementation: use single connection(March 26, 2014))
  • 20. 20 Demo: 1. Flappy Server 2. Tractor
  • 21. Solution disadvantages 21 response PHP Java Server Flappy .phpModel ToJSON() request .jsonTo PhpModel() .jsonTo JavaModel() .javaModel ToJSON()  Write data-mappers manually
  • 22. Future work 22  Tool for generating data mappers  Optimize PHP FlappyClient and develop clients for other languages