SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
Intro to claire-protorpc
@fanyu83
What is claire-protorpc
●
●
●
●
●
●
●

protobuf-based RPC library
non-blocking
event-driving
multi-core ready
modern C++
for x86-64 Linux
BSD license
Tutorial: echo
● In computer telecommunications, echo is the display or
return of sent data at or to the sending end of a
transmission. ------ from wikipedia
● Use claire-protorpc develop application and services
should do:
○ define a .proto file which declared the rpc message
structure and methods
○ use generated stub to call echo methods through
RpcChannel
○ implement echo services, and register it to RpcServer
Echo Client/Server
Stubs

Services

RpcChannel

RpcServer

HttpClient

HttpServer

HttpConnection
echo.proto
● echo.proto define
message and service.
● Use protoc compile the
echo.proto
○ generate echo.pb.h
and echo.pb.cc

// protoc --plugin=protoc-rpc-gen --rpc_out . echo.proto
package echo;

option cc_generic_services = true;

message EchoRequest {
required string str = 1;
}

message EchoResponse {
required string str = 1;
}

service EchoService {
rpc Echo (EchoRequest) returns (EchoResponse);
}
Echo client
● echo.pb.h define Stub
which can call Echo
service
● It need RpcChannel to
communicate remote
server.

int main(int argc, char* argv[])
{
EventLoop loop;

InetAddress server_address(argv[1], 8080);
RpcChannel channel(&loop);
channel.Connect(server_address);

echo::EchoService::Stub stub(&channel);
RpcControllerPtr controller(new RpcController());

echo::EchoRequest request;
request.set_str("0123456789ABCDEF");
stub.Echo(controller, request, boost::bind(&replied, _1, _2));

loop.loop();
}
Echo server
● echo.pb.h define
Abstract interface
EchoService, server side
need implement it.
● EchoService need
register to RpcServer.

int main(int argc, char* argv[])
{
::google::ParseCommandLineFlags(&argc, &argv, true);
InitClaireLogging(argv[0]);

EventLoop loop;
InetAddress listen_address(8080);
echo::EchoServiceImpl impl;
RpcServer server(&loop, listen_address);
server.set_num_threads(FLAGS_num_threads);
server.RegisterService(&impl);
server.Start();
loop.loop();
}
Benefits of claire-protorpc
● claire-protorpc provide:
○
○
○
○
○
○

Define a service only need a function.
Generate stub to call remote service.
Automatic message encode/decode.
Checksum for each message.
Compress data if user set.
Very good performance, at least no obvious
bottleneck.
Concept
●

●
●

●

protobuf provide server declaration but no implementation, it suggest
“provide code generator plugins which generate code specific to the
particular RPC implementation.”
claire-protorpc is one implementation of protobuf-based rpc, and supply
itself plugin to generate code for claire-protorpc only.
It implement 3 important concept of protobuf rpc:
○ RpcController
○ RpcChannel
○ RpcServer
But we do not use Google defined interface directly, instead claire-version!
Service
●

Services themselves are abstract interfaces (implemented either by servers
or as stubs), but they subclass this base interface. The methods of this
interface can be used to call the methods of the Service without knowing
its exact type at compile time (analogous to Reflection).

●

claire-protorpc use protoc-rpc-gen to generate the rpc service which
inherited from Service class(claire-protorpc’s version)
RpcController
● “An RpcController mediates a single method call. The
primary purpose of the controller is to provide a way to
manipulate settings specific to the RPC implementation
and to find out about RPC-level errors.”
● Now it used to declare caller specific option and get error
information.
RpcChannel
● “An RpcChannel represents a communication line to a
Service which can be used to call that Service's methods.
The Service may be running on another machine.
Normally, you should not call an RpcChannel directly,
but instead construct a stub Service wrapping it.”
● Now it used to communicate to RpcServer, it do message
encode/decode, health detection, compress/uncompress,
loadbalance, address resolverm, .etc .
RpcServer
● RpcServer used to store all registered service, and
response to all request.
○ It also provide monitor, debug, profile, flags
management features, user no need write one line
code to use these
Wire Format
message RpcMessage {
required MessageType type = 1;
required fixed64 id = 2;

4 bytes
4 bytes

meesage length
optional string service = 3;
checksum

optional string method = 4;

optional bytes request = 5;
RpcMessage

optional bytes response = 6;

optional ErrorCode error = 7;
optional string reason = 8;

optional CompressType compress_type = 9;
}
Architecture
protoc-rpc-gen

RpcController

RpcChannel

RpcServer

BuiltInService

gen-assets

HttpConnection

HttpClient

HttpServer

Resolver

LoadBalancer

TcpConnection

TcpClient

TcpServer

Inspector

ProtobufIO

Logging

EventLoop

Metrics

String

claire-protorpc

claire-netty

claire-common
System

Symbolizer

Thread

Time

File

gtest

protobuf

profiler

ctemplate

boost

external
c-ares

tcmalloc

snappy

rapidjson

gflags
Features
●
●
●
●
●
●
●
●
●

Health Detection
LoadBalancer(Random, .etc)
Address Resolver(Dns, .etc)
Compress transport
Flags view/modify
Internal statistics view/collection
Online profile
Methods form for test/debug
All built-on Http
/flags
● claire use gflags manage configures.
● Through /flags, user can view and modify flags.
● Easy for modify flags of a lot of machines through /flags
post method.
/flags
Metrics
●

●

claire-protorpc supply powerful metrics type:
○ counter
■ A counter is a value that never decreases. Examples might be
"sent bytes" or "receied bytes". You just increment the counter
each time a countable event happens, and graphing utilities
usually graph the deltas over time.
○ histogram
■ A metric is tracked via distribution, and is usually used for
timings.
claire-protorpc support graphing pages & json interface together
/couters
/histograms
/form
● /form page show all register services & method on
running server, user can post form to server as post
protobuf message
● Easy for test and debug
/form
/pprof
● claire-protorpc integrate with gperftools, so
it support online profiling.
○ support /pprof/profile, /pprof/heap, /pprof/growth
○ also support profile without binary file, through
/pprof/symbol & /pprof cmdlind
○ will support /pprof/contension later
/pprof
Question

github.com/robbinfan/claire-protorpc

Weitere ähnliche Inhalte

Was ist angesagt?

GNU GCC - what just a compiler...?
GNU GCC - what just a compiler...?GNU GCC - what just a compiler...?
GNU GCC - what just a compiler...?Saket Pathak
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerPriyank Kapadia
 
[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4Open Networking Summits
 
Programming Protocol-Independent Packet Processors
Programming Protocol-Independent Packet ProcessorsProgramming Protocol-Independent Packet Processors
Programming Protocol-Independent Packet ProcessorsOpen Networking Summits
 
Sf rmr - Servicing Forwarding Remote Multiplexing Relay
Sf rmr - Servicing Forwarding Remote Multiplexing RelaySf rmr - Servicing Forwarding Remote Multiplexing Relay
Sf rmr - Servicing Forwarding Remote Multiplexing RelayAlenMilincevic
 
Article http over transport protocols
Article   http over transport protocolsArticle   http over transport protocols
Article http over transport protocolsIcaro Camelo
 
Making our Future better
Making our Future betterMaking our Future better
Making our Future betterlegendofklang
 
Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33Max Kleiner
 
Debugging With GNU Debugger GDB
Debugging With GNU Debugger GDBDebugging With GNU Debugger GDB
Debugging With GNU Debugger GDBkyaw thiha
 
Last 2 Months in PHP - July & August 2016
Last 2 Months in PHP - July & August 2016Last 2 Months in PHP - July & August 2016
Last 2 Months in PHP - July & August 2016Eric Poe
 
Programming the Network Data Plane
Programming the Network Data PlaneProgramming the Network Data Plane
Programming the Network Data PlaneC4Media
 
Network Socket Programming with JAVA
Network Socket Programming with JAVANetwork Socket Programming with JAVA
Network Socket Programming with JAVADudy Ali
 
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Aljoscha Krettek
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaJuan Fumero
 
Nb iot-nfapi-implementation-1
Nb iot-nfapi-implementation-1Nb iot-nfapi-implementation-1
Nb iot-nfapi-implementation-1Yafie Abdillah
 
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThe Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThomas Graf
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16Max Kleiner
 
Tutorial of SF-TAP Flow Abstractor
Tutorial of SF-TAP Flow AbstractorTutorial of SF-TAP Flow Abstractor
Tutorial of SF-TAP Flow AbstractorYuuki Takano
 

Was ist angesagt? (20)

Gccgdb
GccgdbGccgdb
Gccgdb
 
GNU GCC - what just a compiler...?
GNU GCC - what just a compiler...?GNU GCC - what just a compiler...?
GNU GCC - what just a compiler...?
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger
 
[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4
 
Programming Protocol-Independent Packet Processors
Programming Protocol-Independent Packet ProcessorsProgramming Protocol-Independent Packet Processors
Programming Protocol-Independent Packet Processors
 
Sf rmr - Servicing Forwarding Remote Multiplexing Relay
Sf rmr - Servicing Forwarding Remote Multiplexing RelaySf rmr - Servicing Forwarding Remote Multiplexing Relay
Sf rmr - Servicing Forwarding Remote Multiplexing Relay
 
Article http over transport protocols
Article   http over transport protocolsArticle   http over transport protocols
Article http over transport protocols
 
Making our Future better
Making our Future betterMaking our Future better
Making our Future better
 
Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33
 
Debugging With GNU Debugger GDB
Debugging With GNU Debugger GDBDebugging With GNU Debugger GDB
Debugging With GNU Debugger GDB
 
Last 2 Months in PHP - July & August 2016
Last 2 Months in PHP - July & August 2016Last 2 Months in PHP - July & August 2016
Last 2 Months in PHP - July & August 2016
 
Programming the Network Data Plane
Programming the Network Data PlaneProgramming the Network Data Plane
Programming the Network Data Plane
 
Network Socket Programming with JAVA
Network Socket Programming with JAVANetwork Socket Programming with JAVA
Network Socket Programming with JAVA
 
GCC, GNU compiler collection
GCC, GNU compiler collectionGCC, GNU compiler collection
GCC, GNU compiler collection
 
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
 
Nb iot-nfapi-implementation-1
Nb iot-nfapi-implementation-1Nb iot-nfapi-implementation-1
Nb iot-nfapi-implementation-1
 
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThe Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16
 
Tutorial of SF-TAP Flow Abstractor
Tutorial of SF-TAP Flow AbstractorTutorial of SF-TAP Flow Abstractor
Tutorial of SF-TAP Flow Abstractor
 

Ähnlich wie Claire protorpc

Cap'n Proto (C++ Developer Meetup Iasi)
Cap'n Proto (C++ Developer Meetup Iasi)Cap'n Proto (C++ Developer Meetup Iasi)
Cap'n Proto (C++ Developer Meetup Iasi)Ovidiu Farauanu
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and ImplementationVarun Talwar
 
Use perl creating web services with xml rpc
Use perl creating web services with xml rpcUse perl creating web services with xml rpc
Use perl creating web services with xml rpcJohnny Pork
 
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
 
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)Michał Kruczek
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsTim Burks
 
Remote procedure calls
Remote procedure callsRemote procedure calls
Remote procedure callsimnomus
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleTim Burks
 
OSN days 2019 - Open Networking and Programmable Switch
OSN days 2019 - Open Networking and Programmable SwitchOSN days 2019 - Open Networking and Programmable Switch
OSN days 2019 - Open Networking and Programmable SwitchChun Ming Ou
 
Microservices Communication Patterns with gRPC
Microservices Communication Patterns with gRPCMicroservices Communication Patterns with gRPC
Microservices Communication Patterns with gRPCWSO2
 
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...apidays
 
Network Test Automation - Net Ops Coding 2015
Network Test Automation - Net Ops Coding 2015Network Test Automation - Net Ops Coding 2015
Network Test Automation - Net Ops Coding 2015Hiroshi Ota
 
Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)Peter R. Egli
 

Ähnlich wie Claire protorpc (20)

Cap'n Proto (C++ Developer Meetup Iasi)
Cap'n Proto (C++ Developer Meetup Iasi)Cap'n Proto (C++ Developer Meetup Iasi)
Cap'n Proto (C++ Developer Meetup Iasi)
 
GRPC.pptx
GRPC.pptxGRPC.pptx
GRPC.pptx
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
 
project_docs
project_docsproject_docs
project_docs
 
Use perl creating web services with xml rpc
Use perl creating web services with xml rpcUse perl creating web services with xml rpc
Use perl creating web services with xml rpc
 
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...
 
Pcp
PcpPcp
Pcp
 
Lecture9
Lecture9Lecture9
Lecture9
 
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
Remote procedure calls
Remote procedure callsRemote procedure calls
Remote procedure calls
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at Google
 
Rpc mechanism
Rpc mechanismRpc mechanism
Rpc mechanism
 
OSN days 2019 - Open Networking and Programmable Switch
OSN days 2019 - Open Networking and Programmable SwitchOSN days 2019 - Open Networking and Programmable Switch
OSN days 2019 - Open Networking and Programmable Switch
 
Microservices Communication Patterns with gRPC
Microservices Communication Patterns with gRPCMicroservices Communication Patterns with gRPC
Microservices Communication Patterns with gRPC
 
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
 
Network Test Automation - Net Ops Coding 2015
Network Test Automation - Net Ops Coding 2015Network Test Automation - Net Ops Coding 2015
Network Test Automation - Net Ops Coding 2015
 
XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)
 
Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)
 
Remote client copy
Remote client copyRemote client copy
Remote client copy
 

Mehr von Fan Robbin

The state of geo in ElasticSearch
The state of geo in ElasticSearchThe state of geo in ElasticSearch
The state of geo in ElasticSearchFan Robbin
 
reliabe by design
reliabe by designreliabe by design
reliabe by designFan Robbin
 
updates from lucene lands 2015
updates from lucene lands 2015updates from lucene lands 2015
updates from lucene lands 2015Fan Robbin
 
All about aggregations
All about aggregationsAll about aggregations
All about aggregationsFan Robbin
 
bm25 demystified
bm25 demystifiedbm25 demystified
bm25 demystifiedFan Robbin
 
Seven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch BenchmarkingSeven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch BenchmarkingFan Robbin
 
AinoVongeCorry_AnIntroductionToArchitectureQuality.ppt
AinoVongeCorry_AnIntroductionToArchitectureQuality.pptAinoVongeCorry_AnIntroductionToArchitectureQuality.ppt
AinoVongeCorry_AnIntroductionToArchitectureQuality.pptFan Robbin
 
广告推荐训练系统的落地实践
广告推荐训练系统的落地实践广告推荐训练系统的落地实践
广告推荐训练系统的落地实践Fan Robbin
 
微博推荐引擎架构蜕变之路
微博推荐引擎架构蜕变之路微博推荐引擎架构蜕变之路
微博推荐引擎架构蜕变之路Fan Robbin
 
可视化的微博
可视化的微博可视化的微博
可视化的微博Fan Robbin
 

Mehr von Fan Robbin (10)

The state of geo in ElasticSearch
The state of geo in ElasticSearchThe state of geo in ElasticSearch
The state of geo in ElasticSearch
 
reliabe by design
reliabe by designreliabe by design
reliabe by design
 
updates from lucene lands 2015
updates from lucene lands 2015updates from lucene lands 2015
updates from lucene lands 2015
 
All about aggregations
All about aggregationsAll about aggregations
All about aggregations
 
bm25 demystified
bm25 demystifiedbm25 demystified
bm25 demystified
 
Seven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch BenchmarkingSeven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch Benchmarking
 
AinoVongeCorry_AnIntroductionToArchitectureQuality.ppt
AinoVongeCorry_AnIntroductionToArchitectureQuality.pptAinoVongeCorry_AnIntroductionToArchitectureQuality.ppt
AinoVongeCorry_AnIntroductionToArchitectureQuality.ppt
 
广告推荐训练系统的落地实践
广告推荐训练系统的落地实践广告推荐训练系统的落地实践
广告推荐训练系统的落地实践
 
微博推荐引擎架构蜕变之路
微博推荐引擎架构蜕变之路微博推荐引擎架构蜕变之路
微博推荐引擎架构蜕变之路
 
可视化的微博
可视化的微博可视化的微博
可视化的微博
 

Kürzlich hochgeladen

Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Kürzlich hochgeladen (20)

Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Claire protorpc

  • 2. What is claire-protorpc ● ● ● ● ● ● ● protobuf-based RPC library non-blocking event-driving multi-core ready modern C++ for x86-64 Linux BSD license
  • 3. Tutorial: echo ● In computer telecommunications, echo is the display or return of sent data at or to the sending end of a transmission. ------ from wikipedia ● Use claire-protorpc develop application and services should do: ○ define a .proto file which declared the rpc message structure and methods ○ use generated stub to call echo methods through RpcChannel ○ implement echo services, and register it to RpcServer
  • 5. echo.proto ● echo.proto define message and service. ● Use protoc compile the echo.proto ○ generate echo.pb.h and echo.pb.cc // protoc --plugin=protoc-rpc-gen --rpc_out . echo.proto package echo; option cc_generic_services = true; message EchoRequest { required string str = 1; } message EchoResponse { required string str = 1; } service EchoService { rpc Echo (EchoRequest) returns (EchoResponse); }
  • 6. Echo client ● echo.pb.h define Stub which can call Echo service ● It need RpcChannel to communicate remote server. int main(int argc, char* argv[]) { EventLoop loop; InetAddress server_address(argv[1], 8080); RpcChannel channel(&loop); channel.Connect(server_address); echo::EchoService::Stub stub(&channel); RpcControllerPtr controller(new RpcController()); echo::EchoRequest request; request.set_str("0123456789ABCDEF"); stub.Echo(controller, request, boost::bind(&replied, _1, _2)); loop.loop(); }
  • 7. Echo server ● echo.pb.h define Abstract interface EchoService, server side need implement it. ● EchoService need register to RpcServer. int main(int argc, char* argv[]) { ::google::ParseCommandLineFlags(&argc, &argv, true); InitClaireLogging(argv[0]); EventLoop loop; InetAddress listen_address(8080); echo::EchoServiceImpl impl; RpcServer server(&loop, listen_address); server.set_num_threads(FLAGS_num_threads); server.RegisterService(&impl); server.Start(); loop.loop(); }
  • 8. Benefits of claire-protorpc ● claire-protorpc provide: ○ ○ ○ ○ ○ ○ Define a service only need a function. Generate stub to call remote service. Automatic message encode/decode. Checksum for each message. Compress data if user set. Very good performance, at least no obvious bottleneck.
  • 9. Concept ● ● ● ● protobuf provide server declaration but no implementation, it suggest “provide code generator plugins which generate code specific to the particular RPC implementation.” claire-protorpc is one implementation of protobuf-based rpc, and supply itself plugin to generate code for claire-protorpc only. It implement 3 important concept of protobuf rpc: ○ RpcController ○ RpcChannel ○ RpcServer But we do not use Google defined interface directly, instead claire-version!
  • 10. Service ● Services themselves are abstract interfaces (implemented either by servers or as stubs), but they subclass this base interface. The methods of this interface can be used to call the methods of the Service without knowing its exact type at compile time (analogous to Reflection). ● claire-protorpc use protoc-rpc-gen to generate the rpc service which inherited from Service class(claire-protorpc’s version)
  • 11. RpcController ● “An RpcController mediates a single method call. The primary purpose of the controller is to provide a way to manipulate settings specific to the RPC implementation and to find out about RPC-level errors.” ● Now it used to declare caller specific option and get error information.
  • 12. RpcChannel ● “An RpcChannel represents a communication line to a Service which can be used to call that Service's methods. The Service may be running on another machine. Normally, you should not call an RpcChannel directly, but instead construct a stub Service wrapping it.” ● Now it used to communicate to RpcServer, it do message encode/decode, health detection, compress/uncompress, loadbalance, address resolverm, .etc .
  • 13. RpcServer ● RpcServer used to store all registered service, and response to all request. ○ It also provide monitor, debug, profile, flags management features, user no need write one line code to use these
  • 14. Wire Format message RpcMessage { required MessageType type = 1; required fixed64 id = 2; 4 bytes 4 bytes meesage length optional string service = 3; checksum optional string method = 4; optional bytes request = 5; RpcMessage optional bytes response = 6; optional ErrorCode error = 7; optional string reason = 8; optional CompressType compress_type = 9; }
  • 16. Features ● ● ● ● ● ● ● ● ● Health Detection LoadBalancer(Random, .etc) Address Resolver(Dns, .etc) Compress transport Flags view/modify Internal statistics view/collection Online profile Methods form for test/debug All built-on Http
  • 17. /flags ● claire use gflags manage configures. ● Through /flags, user can view and modify flags. ● Easy for modify flags of a lot of machines through /flags post method.
  • 19. Metrics ● ● claire-protorpc supply powerful metrics type: ○ counter ■ A counter is a value that never decreases. Examples might be "sent bytes" or "receied bytes". You just increment the counter each time a countable event happens, and graphing utilities usually graph the deltas over time. ○ histogram ■ A metric is tracked via distribution, and is usually used for timings. claire-protorpc support graphing pages & json interface together
  • 22. /form ● /form page show all register services & method on running server, user can post form to server as post protobuf message ● Easy for test and debug
  • 23. /form
  • 24. /pprof ● claire-protorpc integrate with gperftools, so it support online profiling. ○ support /pprof/profile, /pprof/heap, /pprof/growth ○ also support profile without binary file, through /pprof/symbol & /pprof cmdlind ○ will support /pprof/contension later