All Projects → wangzihaogithub → spring-boot-protocol

wangzihaogithub / spring-boot-protocol

Licence: Apache-2.0 License
springboot功能扩充-netty动态协议,可以支持各种网络协议的动态切换(单端口支持多个网络协议).支持mmap,sendfile零拷贝,http请求批量聚合

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to spring-boot-protocol

Netty Learning Example
🥚 Netty实践学习案例,见微知著!带着你的心,跟着教程。我相信你行欧。
Stars: ✭ 2,146 (+3055.88%)
Mutual labels:  mqtt, netty, rpc
Tutorial
Java全栈知识架构体系总结
Stars: ✭ 407 (+498.53%)
Mutual labels:  mqtt, netty, springcloud
Socket Mqtt
基于Netty+MQTT的高性能推送服务框架。支持普通Socket、MQTT、MQTT web socket协议。非常方便接入上层业务实现推送业务。
Stars: ✭ 314 (+361.76%)
Mutual labels:  mqtt, netty, rpc
micro-service-practice
OpenStack+Docker+RestAPI+OAuth/HMAC+RabbitMQ/ZMQ+OpenResty/HAProxy/Nginx/APIGateway+Bootstrap/AngularJS+Ansible+K8S/Mesos/Marathon构建/探索微服务最佳实践。
Stars: ✭ 25 (-63.24%)
Mutual labels:  rpc, springcloud
Pjon
PJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
Stars: ✭ 2,615 (+3745.59%)
Mutual labels:  mqtt, protocol
JavaHub
Java程序员学习之路,持续更新原创内容,欢迎Star
Stars: ✭ 27 (-60.29%)
Mutual labels:  netty, springcloud
sirdez
Glorious Binary Serialization and Deserialization for TypeScript.
Stars: ✭ 20 (-70.59%)
Mutual labels:  protocol, rpc
muxrpc
lightweight multiplexed rpc
Stars: ✭ 96 (+41.18%)
Mutual labels:  protocol, rpc
ws-promise
A tiny, Promise-based WebSocket protocol allowing request-response usage in ECMAScript
Stars: ✭ 20 (-70.59%)
Mutual labels:  protocol, rpc
litchi
这是一款分布式的java游戏服务器框架
Stars: ✭ 97 (+42.65%)
Mutual labels:  netty, rpc
RPC
RPC is a highly available pluggable architecture for remote calls
Stars: ✭ 31 (-54.41%)
Mutual labels:  netty, rpc
rpc
自己编写的rpc调用框架,配置简单,使用更简单,如果您感觉有用请点赞,纯个人手写
Stars: ✭ 29 (-57.35%)
Mutual labels:  netty, rpc
Iot Dc3
IOT DC3 is an open source, distributed Internet of Things (IOT) platform based on Spring Cloud. It is used for rapid development of IOT projects and management of IOT devices. It is a set of solutions for IOT system.
Stars: ✭ 195 (+186.76%)
Mutual labels:  mqtt, rpc
Blynk Server
Blynk is an Internet of Things Platform aimed to simplify building mobile and web applications for the Internet of Things. Easily connect 400+ hardware models like Arduino, ESP8266, ESP32, Raspberry Pi and similar MCUs and drag-n-drop IOT mobile apps for iOS and Android in 5 minutes
Stars: ✭ 8 (-88.24%)
Mutual labels:  mqtt, netty
thinglinks
开源ThingLinks物联网一体化平台,高性能、高吞吐量、高扩展性的物联网平台!单机可以支持百万链接,同时支持自定义扩展功能,功能非常强大,采用netty作为通信层组件,支持插件化开发集成!
Stars: ✭ 338 (+397.06%)
Mutual labels:  netty, springcloud
Esp32 Mqtt
ESP32 MQTT sample project for
Stars: ✭ 166 (+144.12%)
Mutual labels:  mqtt, protocol
metacom
RPC communication protocol for Metarhia stack 🔌
Stars: ✭ 42 (-38.24%)
Mutual labels:  protocol, rpc
Pudding
Pudding 是一款迷你级分布式服务框架
Stars: ✭ 24 (-64.71%)
Mutual labels:  netty, rpc
Jetlinks Community
JetLinks 基于Java8,Spring Boot 2.x ,WebFlux,Netty,Vert.x,Reactor等开发, 是一个全响应式的企业级物联网平台。支持统一物模型管理,多种设备,多种厂家,统一管理。统一设备连接管理,多协议适配(TCP,MQTT,UDP,CoAP,HTTP等),屏蔽网络编程复杂性,灵活接入不同厂家不同协议等设备。实时数据处理,设备告警,消息通知,数据转发。地理位置,数据可视化等。能帮助你快速建立物联网相关业务系统。
Stars: ✭ 2,405 (+3436.76%)
Mutual labels:  mqtt, netty
Joynr
A transport protocol agnostic (MQTT, HTTP, WebSockets etc.) Franca IDL based communication framework supporting multiple communication paradigms (RPC, Pub-Sub, broadcast etc.)
Stars: ✭ 124 (+82.35%)
Mutual labels:  mqtt, rpc

Spring-boot-protocol (用Netty实现)

将springboot的WebServer改为了NettyTcpServer, 为使用者扩充了网络编程的能力.

多协议服务器, Springboot协议扩展包, 允许单端口提供多协议服务.其中内置多种网络传输(标准与规范)的实现库, 轻松添加或扩展协议. 例: HttpServlet, RPC, MQTT(物联网通讯协议), Websocket, RTSP(流媒体协议), DNS(域名解析协议),MYSQL协议.

1.可以替代tomcat或jetty. 导包后一个@EnableNettyEmbedded注解即用. 

2.支持http请求聚合, 然后用 select * from id in (httpRequestList). 示例:com.github.netty.http.example.HttpGroupByApiController.java

3.支持异步零拷贝。sendFile, mmap. 示例:com.github.netty.http.example.HttpZeroCopyController.java

4.HttpServlet性能比tomcat的NIO2高出 25%/TPS。
    1. Netty的池化内存,减少了GC对CPU的消耗 
    2. Tomcat的NIO2, 注册OP_WRITE后,tomcat会阻塞用户线程等待, 并没有释放线程. 
    3. 与tomcat不同,支持两种IO模型,可供用户选择

5.RPC性能略胜阿里巴巴的Dubbo(因为IO模型设计与dubbo不同,减少了线程切换), 使用习惯保持与springcloud相同

6.Mysql,MQTT等协议可以在不依赖协议网关, 单机单端口同时支持N种协议 (例: HTTP,MQTT,Mysql,Websocket.)

7.可以添加自定义传输协议. (例: 定长传输, 分隔符传输)

8.开启Mysql协议,代理处理客户端与服务端的数据包, 记录mysql日志.
/spring-boot-protocol/netty-mysql/zihaoapi.cn_3306-127.0.0.1_57998-packet.log

{
    "timestamp":"2021-01-04 22:10:19",
    "sequenceId":0,
    "connectionId":8720,
    "handlerType":"backend",
    "clientCharset":"utf8_general_ci",
    "serverCharset":"latin1_swedish_ci",
    "packet":"ServerHandshakePacket,5.6.39-log,[AUTO_COMMIT]"
},
{
    "timestamp":"2021-01-04 22:10:19",
    "sequenceId":1,
    "connectionId":8720,
    "handlerType":"frontend",
    "clientCharset":"utf8_general_ci",
    "serverCharset":"latin1_swedish_ci",
    "packet":"ClientHandshakePacket,db1,root,{_runtime_version=12.0.2, _client_version=8.0.19, _client_license=GPL, _runtime_vendor=Oracle Corporation, _client_name=MySQL Connector/J}"
},
{
    "timestamp":"2021-01-04 22:10:19",
    "sequenceId":2,
    "connectionId":8720,
    "handlerType":"backend",
    "clientCharset":"utf8_general_ci",
    "serverCharset":"latin1_swedish_ci",
    "packet":"ServerOkPacket,[AUTO_COMMIT]"
},
{
    "timestamp":"2021-01-04 22:10:19",
    "sequenceId":0,
    "connectionId":8720,
    "handlerType":"frontend",
    "clientCharset":"utf8_general_ci",
    "serverCharset":"latin1_swedish_ci",
    "packet":"ClientQueryPacket,COM_QUERY,select * from order"
},
{
    "timestamp":"2021-01-04 22:10:19",
    "sequenceId":1,
    "connectionId":8720,
    "handlerType":"backend",
    "clientCharset":"utf8_general_ci",
    "serverCharset":"latin1_swedish_ci",
    "packet":"ServerColumnCountPacket,6"
},
{
    "timestamp":"2021-01-04 22:10:19",
    "sequenceId":2,
    "connectionId":8720,
    "handlerType":"backend",
    "clientCharset":"utf8_general_ci",
    "serverCharset":"latin1_swedish_ci",
    "packet":"ServerColumnDefinitionPacket,order_id"
},

作者邮箱 : [email protected]

github地址 : https://github.com/wangzihaogithub

如果需要不依赖spring的servlet, 可以使用 https://github.com/wangzihaogithub/netty-servlet (支持文件零拷贝,可扩展底层通讯)

使用方法

1.添加依赖, 在pom.xml中加入 Maven Central

<!-- https://mvnrepository.com/artifact/com.github.wangzihaogithub/spring-boot-protocol -->
<dependency>
  <groupId>com.github.wangzihaogithub</groupId>
  <artifactId>spring-boot-protocol</artifactId>
  <version>2.1.12</version>
</dependency>

2.开启netty容器

@EnableNettyEmbedded//切换容器的注解
@SpringBootApplication
public class ExampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(ExampleApplication.class, args);
    }
}

3.启动, 已经成功替换tomcat, 切换至 NettyTcpServer!

2019-02-28 22:06:16.192  INFO 9096 --- [er-Boss-NIO-2-1] c.g.n.springboot.server.NettyTcpServer   : NettyTcpServer@1 start (port = 10004, pid = 9096, protocol = [my-protocol, http, nrpc, mqtt], os = windows 8.1) ...
2019-02-28 22:06:16.193  INFO 9096 --- [           main] c.g.example.ProtocolApplication10004     : Started ProtocolApplication10004 in 2.508 seconds (JVM running for 3.247)    

更多功能例子example-> 请点击这里查看示例代码

示例1. 编写并添加一个自定义传输协议
示例2. springcloud中替换Feign的调用方式
示例3. 对springboot-websocket的支持
示例4. 协议网关, 监控各个协议的流量

核心代码

com.github.netty.springboot.server.NettyTcpServer服务器启动时

com.github.netty.protocol.DynamicProtocolChannelHandler 接收新链接的第一个TCP数据包进行路由

com.github.netty.core.ProtocolHandler 处理之后的数据交换逻辑

如何参与

  • 有问题交issue, 想改代码直接pull request即可. github都会通过微信及时通知我.

  • 有不懂得地方,我都会及时回复.

  • 如果觉得这个产品还不错,请多多向您的朋友、同事推荐,感谢至极

http://alios.cn

http://liteos.com

http://rt-thread.org

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].