A industrial-grade RPC framework used throughout Baidu, with 600,000+ instances(not counting clients) and 500+ kinds of services, called "baidu-rpc" inside Baidu. Only C++ implementation is opensourced right now.
You can use it to:
- Build a server that can talk in multiple protocols (on same port), or access all sorts of services
- restful http/https, h2/h2c (compatible with grpc, will be opensourced). using http in brpc is much more friendly than libcurl.
- redis and memcached, thread-safe, more friendly and performant than the official clients
- rtmp/flv/hls, for building live-streaming services.
- hadoop_rpc(not opensourced yet)
- rdma support via openucx (will be opensourced)
- all sorts of protocols used in Baidu: baidu_std, streaming_rpc, hulu_pbrpc, sofa_pbrpc, nova_pbrpc, public_pbrpc, ubrpc, and nshead-based ones.
- Access protobuf-based protocols with HTTP+json, probably from another language.
- Build HA distributed services using an industrial-grade implementation of RAFT consensus algorithm (will be opensourced at braft)
- Create rich processing patterns
- Services can handle requests synchronously or asynchronously.
- Access service synchronously or asynchronously, or even semi-synchronously.
- Use combo channels to simplify complicated client patterns declaratively, including sharded and parallel accesses.
- Debug services via http, and run cpu, heap and contention profilers.
- Get better latency and throughput.
- Extend brpc with the protocols used in your organization quickly, or customize components, including naming services (dns, zk, etcd), load balancers (rr, random, consistent hashing)
Try it!
- Read overview to know where brpc can be used and its advantages.
- Read building steps to get started and play with examples.
- Docs:
- Performance benchmark
- bvar
- bthread
- Client
- Server
- Builtin Services
- Tools
- Others
- IOBuf
- Streaming Log
- FlatMap
- brpc外功修炼宝典(新人培训材料)
- RPC in depth
- Use cases inside Baidu
Contribute code
brpc welcomes contributions, especially those on adapting different platforms and extending protocols.
Make sure the code meets following requirements before submitting your PR:
- Conforms to google C++ coding style
- The code appears where it should be. For example the code to support an extra protocol should not be put in general classes like server.cpp, channel.cpp, while a general modification would better not be hidden inside a very specific protocol.
- Has unittests.
Check following items after submitting the PR:
- Compilations and unittests in travis-ci are passed.