288 Star 981 Fork 227

helyho/Voovan

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
Apache-2.0

JDK 1.7 jar size 830K

Voovan 是一个高性能异步网络框架和WEB服务器框架,同时支持HTTP客户端抓取、动态编译支持、数据库访问封装以及DateTime、String、Log、反射、对象工具、流操作、文件操作、异步双向通道等功能。旨在提供可靠、方便、可单元测试的代码。它是极少依赖的独立工具包,希望能够方便广大开发者快速的实现应用。

开源协议: Apache v2 License

极简并且优雅的编码是 Voovan 的宗旨和目标


传送门 链接
外媒新闻 Naked Performance With Clojure 重点在第七页
TFB 性能测试 Round 19 2019-10-24
文档入口 Voovan 开发手册
入门教程 Voovan 一步步入门

联系我们 链接
QQ Group: 454201740
Email: helyho@gmail.com
Issues GitHub

Maven中央库支持:

  <dependency>
      <groupId>org.voovan</groupId>
      <artifactId>voovan-framework</artifactId>
      <version>4.3.8</version>
  </dependency>

JitPack仓库支持:

  • 最新版请跟进 jitpack 仓库
      <repositories>
          <repository>
              <id>jitpack.io</id>
              <url>https://jitpack.io</url>
          </repository>
      </repositories>
    
      <dependency>
          <groupId>com.github.helyho.Voovan</groupId>
          <artifactId>voovan-framework</artifactId>
          <version>e1c501439b</version>
      </dependency>

Web模块:

  • WebServer 对注解形式路由的支持, 类似一个轻量化的 Spring MVC
  • WebServer 增加热部署支持, 修改类和 jar 中的类,无须重启 web 服务
  • WebServer 增加扫描新类和 jar 到 ClassPath 的支持,新增类和 jar 无须重启 web 服务
  • WebServer 路径变量抽取算法优化, 以获得性能提升
  • WebServer 实现基于 redis 的 session 共享形式的集群
  • WebServer 提供对基于 Websocket 协议的 socket.io 和 engine.io 的支持

Network 模块:

  • 提高了 Voovan 对于并发性能的支持,测试结果并发性能提升为10%-15%
  • 优化ByteBufferChannel增加 shrink \ read \ write 的通用方法
  • IoSession 的状态模型重构
  • 增加心跳控制

Common 模块:

  • 新增时间轮定时任务,并且支持异步任务的方式,Voovan 内部所有定时器全部都替换为时间轮的方式,以提升性能

  • 增加了动态编译以及沙盒对于加载类的安全控制

    - 动态类的的支持,参见:org.voovan.tools.compiler.clazz.DynamicClass
    - 动态函数的的支持,参见:org.voovan.tools.compiler.function.DynamicFunction
    - 动态编译部分的沙盒安全支持: /Voovan/Common/src/main/resources/sandbox.properties
  • 提供通用的热部署支持,使任何 JVM 应用都能够支持热部署, 参见: org.voovan.tools.hotswap.Hotswaper


典型案例:

  • 商旅行业酒店预订系统,基于 Voovan 开发的后端API服务
  • 基于 Voovan 开发物联网管理服务
  • 基于 Voovan 开发的游戏后端服务
  • 基于 Voovan 开发的 WEB 服务以及手机推送服务
  • 某通信企业基于 Voovan开发每分钟通信 10w+ 次的关口机
  • Vestful 一款提供 Restful 服务的框架
  • Dockerfly 一款 Docker web 管理工具
  • JDocker 一款 java 开发 Docker API 封装的框架
  • 某区块链交易所后端所有服务都基于 Voovan 运行, 以稳定运行一年半(截至2020年4月)

** Voovan 相关新闻 **

日期 标题
2017-06-28 t-io 和 Voovan 并发性能测试
2017-06-02 Netty、t-io、Voovan 框架浅谈
2017-02-21 Netty与Voovan并发性能对比
2017-01-04 Voovan 参照 Jetty 的性能测试

JDK支持:

  • 推荐使用 JDK11,懒人专用。
  • 目前自 4.3.8 开始所有版本在发布前都会进行 jdk11的测试。
  • 如果 WebServer 使用lambda 需要 JDK11,不使用 lambda 需要 JDK1.7。
  • 有能力的同学可以通过很简单几行修改使 WebServer 和 HTTPClient使用 NIO 那么就是 JDK1.6。

框架特点介绍:

  • 使用 JDK 的 lambda 表达式,快速实现 HTTP/WebSocket 服务的开发。【演示】/【TFB性能测试】
  • 异步通信框架解决粘包问题,过滤器链等。
  • 独立无依赖的代码。
  • 源码注释丰富,方便码友学习、调试、使用。

一、高性能异步通信(NIO异步通信) [voovan-network]

类似 Netty 和 MINA 的异步 Socket 通信框架.但有有所不同。

  1. 可灵活解决Socket通信粘包的支持(源码中包含 HTTP协议,字符串换行,定长报文的粘包实现)。
  2. 支持 SSL/TLS 加密通信。
  3. 提供线程池依据系统负载情况自动动态调整。
  4. 采用非阻塞方式的异步传输。
  5. 事件驱动(Connect、Recive、Sent、Close、Exception),采用回调的方式完成调用。
  6. 可灵活的加载过滤器机制。

二、HTTP客户端和WEB服务器[voovan-web] HTTP客户端特性:

  1. 基于 Voovan 异步通信框架实现。
  2. 客户端可以灵活自定义请求报文。
  3. 同步实现 HTTP请求(需要同步实现可参考)。
  4. 实现 WebSocket 客户端调用,可以连接任何支持 WebSocket Version 13的 WebSocket 服务。

WEB服务器特性:[voovan-web]

  1. 支持 WebSocket Version 13,并且保持 WebSocket请求参数。
  2. 使用 Lambda 实现更加方便的 Http 响应实现。
  3. 支持路径参数自动抽取 当路径定义/:name,在使用/jonh地址访问时,可以通过 name 参数获取 jonh 字符串。
  4. 重定向支持。
  5. 可灵活实现session共享。
  6. 异常统一展示支持。
  7. MIME 配置支持。
  8. 支持基于 HTTP1.1 的 HTTPS 访问,默认采用TLS模式.
  9. 支持性能监控. [HTTP服务端性能监控演示]

三、动态编译支持 [voovan-common]

在内存中编一个保存有 java 代码的字符串,并将编译后的 byte 字节加入到 classloader 中,可灵活的动态定义类和使用。


四、数据库操作帮助类 [voovan-database] 提供类似Spring JDBCTemplate 的数据访问支持,但提供了更好更灵活易用的函数设计。

  • 支持的参数类型:
  • Map 参数
  • 不定参数
  • 对象作为参数
  • 支持存储过程调用。
  • 支持批量更新。
  • 数据库事务的支持。
  • 支持自动移除无匹配参数的条件。
  • 结果转换对象的时候使用模糊匹配。

五、DateTime、String、Log、反射、对象工具、流操作、文件操作、异步双向通道等 [voovan-common]

  1. 简单的 JSON 序列化和反序列化,效率比不过专业的序列化工具(如:FastJson),但重在轻量级好用。
  2. 日期类型和字符串和日期类型互转,日期类型加减操作。
  3. 反射的快捷实现,可直接通过反射取属性值,调用方法,实例化对象,判断类的继承及实现
  4. 简单的日志记录类,支持指定输出流,日志报文自定义等。
  5. 简单的自推导的对象类型强制转换,根绝参数类型,运算类型自动退定强制转换类型。
  6. 流操作,读取定长、按行读取、基于byte的split操作等。
  7. 使用 ByteBuffer 实现的一个双向通道。
  8. 属性文件操作。
  9. 文件路径拼接、从绝对路径读取、从相对路径读取、从包路径读取、指定起始和结束位置内容读取等。
  10. List 和 Map 的快速初始化。
  11. 热部署
  12. 动态函数和类

包结构说明

包名 名称
org.voovan.db 数据库操作类
org.voovan.http HTTP工具包
org.voovan.dynamicComplier 动态编译包
org.voovan.network 网络异步通信包
org.voovan.tools 基本工具包

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Voovan是高性能异步通信、HTTP服务器和客户端通信、动态编译支持、数据库操作帮助类等工具的框架。如果项目觉得不错, 请点一下 star, 谢谢 expand collapse
Java and 5 more languages
Apache-2.0
Cancel

Releases (1)

All

Contributors

All

Activities

Load More
can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/helyho/Voovan.git
git@gitee.com:helyho/Voovan.git
helyho
Voovan
Voovan
master

Search

344bd9b3 5694891 D2dac590 5694891