All Projects → baidu → Brpc Java

baidu / Brpc Java

Licence: apache-2.0
Java implementation for Baidu RPC, multi-protocol & high performance RPC.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Brpc Java

Joyrpc
high-performance, high-extensibility Java rpc framework.
Stars: ✭ 290 (-55.18%)
Mutual labels:  microservice, grpc, rpc, dubbo, high-performance
Rpcx
Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱!
Stars: ✭ 6,516 (+907.11%)
Mutual labels:  microservice, grpc, rpc, dubbo
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (-17.77%)
Mutual labels:  microservice, rpc, protobuf, netty
Mrpc
🐿 netty,zookeeper,spring,kyro rpc framework.
Stars: ✭ 128 (-80.22%)
Mutual labels:  rpc, protobuf, spring-boot, netty
Tesla
Tesla is a gateway service that provides dynamic routing,waf,support spring cloud,gRPC,DUBBO and more.
Stars: ✭ 161 (-75.12%)
Mutual labels:  grpc, dubbo, spring-cloud, high-performance
Dapeng Soa
A lightweight, high performance micro-service framework
Stars: ✭ 101 (-84.39%)
Mutual labels:  microservice, rpc, high-performance, netty
Jupiter
Jupiter是一款性能非常不错的, 轻量级的分布式服务框架
Stars: ✭ 1,372 (+112.06%)
Mutual labels:  microservice, rpc, high-performance, netty
Go Micro Boilerplate
The boilerplate of the GoLang application with a clear microservices architecture.
Stars: ✭ 147 (-77.28%)
Mutual labels:  microservice, grpc, rpc, protobuf
Armeria
Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
Stars: ✭ 3,392 (+424.27%)
Mutual labels:  grpc, rpc, netty
Micro Company
Rest-full, Hipermedia-based distributed application. Spring boot & cloud. Angular. CQRS. Eventsourcing. Axonframework. Microservices. Docker. CloudFoundry
Stars: ✭ 307 (-52.55%)
Mutual labels:  microservice, spring-boot, spring-cloud
Dis Seckill
👊SpringBoot+Zookeeper+Dubbo打造分布式高并发商品秒杀系统
Stars: ✭ 315 (-51.31%)
Mutual labels:  rpc, dubbo, spring-boot
Flatbuffers
FlatBuffers: Memory Efficient Serialization Library
Stars: ✭ 17,180 (+2555.33%)
Mutual labels:  grpc, rpc, protobuf
Spring Boot Demo
spring boot demo 是一个Spring Boot、Spring Cloud的项目示例,根据市场主流的后端技术,共集成了30+个demo,未来将持续更新。该项目包含helloworld(快速入门)、web(ssh项目快速搭建)、aop(切面编程)、data-redis(redis缓存)、quartz(集群任务实现)、shiro(权限管理)、oauth2(四种认证模式)、shign(接口参数防篡改重放)、encoder(用户密码设计)、actuator(服务监控)、cloud-config(配置中心)、cloud-gateway(服务网关)等模块
Stars: ✭ 323 (-50.08%)
Mutual labels:  spring-boot, spring-cloud, netty
Poplar
A social networking application written by React Native
Stars: ✭ 373 (-42.35%)
Mutual labels:  microservice, dubbo, spring-boot
Javaspringbootsamples
SpringBoot、Dubbo、SpringCloud的各种集成例子:Atomikos、gRPC、Thrift、Seata、ShardingSphere、Dubbo、Hmily、Nacos、Consul、Ribbon、Jedis、Lettuce、Redisson等框架
Stars: ✭ 399 (-38.33%)
Mutual labels:  grpc, rpc, dubbo
Yarpc Go
A message passing platform for Go
Stars: ✭ 285 (-55.95%)
Mutual labels:  grpc, rpc, protobuf
Cola Cloud
Cola Cloud 基于 Spring Boot, Spring Cloud 构建微服务架构企业级开发平台,集成OAuth2认证、集成短信验证码登录、微信小程序登录、FlyWay数据库版本管理、网关集成Swagger聚合所有服务API文档。基于SpringBootAdmin集成Hystrix、Turbine监控。开发用户中心、权限管理、组织架构、数据字典、消息中心、通知中心等模块。基于MyBatisPlus Generator 开发代码生成器
Stars: ✭ 285 (-55.95%)
Mutual labels:  microservice, spring-boot, spring-cloud
Spring boot
Spring Boot 使用总结 和 demo。 如果您觉得本代码对您有所帮助,请点击页面右上方"Star"
Stars: ✭ 431 (-33.38%)
Mutual labels:  grpc, protobuf, spring-boot
Cookbook
🎉🎉🎉JAVA高级架构师技术栈==任何技能通过 “刻意练习” 都可以达到融会贯通的境界,就像烹饪一样,这里有一份JAVA开发技术手册,只需要增加自己练习的次数。🏃🏃🏃
Stars: ✭ 428 (-33.85%)
Mutual labels:  spring-boot, spring-cloud, netty
Rpc Benchmark
java rpc benchmark, 灵感源自 https://www.techempower.com/benchmarks/
Stars: ✭ 463 (-28.44%)
Mutual labels:  grpc, rpc, dubbo

Build Status Coverage License Maven

项目名称

brpc-java 是 baidu rpc 的 java 版本实现,支持 baidu rpc、nshead、sofa、hulu、http、stargate、dubbo 等协议。

核心功能点

  • 支持 baidu rpc 标准协议、sofa 协议、hulu 协议、nshead+protobuf 协议、http+protobuf/json 协议、public pbrpc、stargate、dubbo协议。
  • 支持 Spring Boot Starter,也支持 Spring Cloud 的服务注册发现、用 brpc-java 替换 Feign HTTP 调用,提升性能。
  • 支持 Server Push 机制,并支持扩展 Server Push 协议。
  • 支持多种 naming 服务,比如 Zookeeper、Consul、List、File、DNS 等,可以灵活扩展支持 etcd、eureka、nacos 等。
  • 支持多种负载均衡策略,比如 fair、random、round robin、weight 等。
  • 支持 interceptor 功能,支持计数器、令牌桶等 server 端限流算法。
  • RPC 功能可独立使用,不是必须依赖 Spring 和注册中心功能。
  • 基于 SPI 机制可灵活扩展 Protocol、NamingService 和 LoadBalance。

快速开始

开发环境

java 6+ && protobuf 2.5.0+

引入 maven 依赖

protobuf 2.x 环境

非 Spring 环境:

<dependency>
    <groupId>com.baidu</groupId>
    <artifactId>brpc-java</artifactId>
    <version>3.0.2</version>
</dependency>

Spring 环境:

<dependency>
    <groupId>com.baidu</groupId>
    <artifactId>brpc-spring</artifactId>
    <version>3.0.2</version>
</dependency>

Spring Boot 环境:

<dependency>
    <groupId>com.baidu</groupId>
    <artifactId>brpc-spring-boot-starter</artifactId>
    <version>3.0.2</version>
</dependency>

Spring Cloud 环境:

<dependency>
    <groupId>com.baidu</groupId>
    <artifactId>spring-cloud-brpc</artifactId>
    <version>3.0.2</version>
</dependency>

Zookeeper 注册中心:

<dependency>
    <groupId>com.baidu</groupId>
    <artifactId>brpc-java-naming-zookeeper</artifactId>
    <version>3.0.2</version>
</dependency>

Consul 注册中心:

<dependency>
    <groupId>com.baidu</groupId>
    <artifactId>brpc-java-naming-consul</artifactId>
    <version>3.0.2</version>
</dependency>

protobuf 3.x 环境

除了引入 protobuf 2.x 环境所需依赖外,还需要增加 protobuf 3.x 依赖:

<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java</artifactId>
    <version>3.11.0</version>
</dependency>
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java-util</artifactId>
    <version>3.11.0</version>
</dependency>

Server 端使用

Client 端使用

与 Spring 集成

扩展

一些设计

网络模型

采用 Netty 的 Reactor 网络模型,但跟常规用法有些不同:

  • 没有使用 Netty 的 ByteToMessageDecoder 去解析协议,因为 ByteToMessageDecoder 内部会对 buffer 进行拷贝。
  • 为了提高并发,尽量少在 IO 线程中执行业务逻辑,所以在 IO 线程中只会去解析协议的 Header 部分,并把 body 的 buffer retain 出来,然后丢给工作线程去处理;工作线程会 decode body,并执行具体业务逻辑。
  • 由于粘包/拆包问题,可能一次 socket 读操作会包含多个包,所以支持了批量往工作线程中 submit 任务。

零拷贝 Buffer

线程池 ThreadPool

  • 调研过 JDK 的 ThreadPoolExecutor、ConcurrentLinkedQueue 以及 Disruptor,最后使用更高性能的 ThreadPool
  • ThreadPool 内部把生产者队列、消费者队列分开,用两个锁去控制同步,当 consumer queue 为空时,且 producer queue 不为空条件满足时,会交换两个队列。

比ConcurrentHashMap 更快的 FastFutureStore

压力测试数据

部署环境:

  • Client/Server 机器配置:CPU 12核,内存 132G,千兆网卡。
  • 压测代码

压力测试结果:

数据量 5 byte 1k byte 2k byte 4k byte
QPS 220k 100k 53k 27k

微信交流群:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].