当前位置: 首页 > 软件库 > 云计算 > >

light-4j

授权协议 Apache-2.0 License
开发语言 Java
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 鲁德佑
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

A fast, lightweight and cloud-native microservices framework.

Stack Overflow |Google Group |Gitter Chat |Subreddit |Youtube Channel |Documentation |Contribution Guide |

Why call it Light-4J

Light means lightweight, lightning fast and shedding light on how to program with modern Java SE for cloud-native deployment.

Why am I doing it

I had been working on the Java EE platforms since early 2000 and suffered the performance and productivity issues. In 2014, I realized that the IT industry was moving from Monolithic to Microservices and from on-premise data centers to the public clouds.

To reduce the production cost for my applications, I need to find a lightweight platform that has a small memory footprint, high throughput, and low latency in Java. Java EE and Spring/Spring Boot are too heavy to be considered. Other lightweight Java platforms all have different issues on the separation between the business logic and technical cross-cutting concerns. Moreover, they are not cloud-native or designed for container/cloud.

Without finding anything suitable, I started to build my open-source platform light-4j on top of the Undertow HTTP core by following the principles. Because my approach is very radical, and it is against products from big corporations, I have been attacked by some entities online and offline constantly. However, I am so convinced that my approach is the future direction and spend all my effort to continue the development. Today, a lot of companies are using light-4j on production with very positive feedback. It further encourages me to devote myself to the framework and to extend the platform to build an ecosystem.

For users who benefit from the platform, you can become a sponsor for me so that I can put all my effort into the open-source projects.

Why use this framework

Fast and small memory footprint to lower production cost.

It is 44 times faster than the most popular microservices platform Spring Boot embedded Tomcat and use only 1/5 of memory. Here are the benchmark results compare with Spring Boot and other microservices frameworks. Here is the third party comparison with other Web frameworks.

Provide an embedded gateway to address cross-cutting concerns.

  • Plugin architecture for startup/shutdown hooks and middleware components
  • Distributed OAuth2 JWT security verification as part of the framework
  • Request and response validation against OpenAPI specification at runtime
  • Metrics collected in Influxdb/Prometheus and viewed from Grafana Dashboard for both services and clients
  • Global exception handling for runtime exception, API exception, and other checked exceptions
  • Mask sensitive data like the credit card, sin number, etc. before logging
  • Sanitize cross-site scripting for query parameters, request headers and body
  • Audit to dump important info or entire request and response.
  • Body parser to support different content types
  • Standardized response code and messages from the configuration file
  • Externalized configuration for all modules for the dockerized environment
  • CORS pre-flight handler for SPA (Angular or React) from another domain
  • Rate limiting for services that exposed outside to the Internet
  • Service registry and discovery support direct, Consul and Zookeeper
  • Client-side discovery and load balance to eliminate proxies
  • A client module that is tightly integrated with Light-OAuth2 and supports traceability

Design and Test driven development to increase productivity

Design OpenAPI specification and generate the service from it. The specification is alsopart of the framework to drive security verification and request validation at runtime.

Unit/End-to-End test stubs are generated to enable test driven approach for quality product.

Debugging within IDE just like standalone application for better developer productivity.

Built-in DevOps flow to support continuous integration to production

Dockerfile and DevOps supporting files are generated to support dockerization and continuousintegration to production.

Multiple frameworks for different type of microservices

  • light-rest-4j is a RESTful microservice framework with OpenAPI specification for code generation and runtime security and validation
  • light-graphql-4j is a GraphQL microservice framework that supports schema generation from IDL and plugin.
  • light-hybrid-4j is a hybrid microservice framework that takes advantages of both monolithic and microservice architectures.
  • light-eventuate is a messaging based microservice framework based on Kafka, event sourcing and CQRS

Multiple languages support

All the open sourced frameworks are built in Java and we are working on Nodejs framework internally.In the future, we might provide Golang framework as well and all them are sharing the same eco-systemand market place.

OAuth2 server, portal and services to form ecosystem

OAuth2 Server for security and Portalfor production monitor and management. The portal is also a marketplace to link clients and servicestogether.

Getting Started

There are two ways to start your project:

Light-codegen generator

You can use light-codegen to generate a working project.Currently, it supports light-rest-4j, light-graphql-4j, light-hybrid-server-4j and light-hybrid-service-4j.light-eventuate code generator is coming.

The light-codegen project README.md describes four ways to use the generator with examples.

  • Clone and build the light-codgen and use the codegen-cli command line utility
  • Use docker image networknt/light-codegen to run the codegen-cli command line utility
  • Use generate.sh from model-config repo to generate projects based on conventions.
  • Generate code from web site with codegen-web API. (API is ready but UI needs to be built)

Starting from an example project

The other way to start your project is to copy from light-example-4j.

You can find the description of these examples

Also, there are some tutorials

Debugging

To run/debug from IDE, you need toconfigure a Java application with main class "com.networknt.server.Server" and workingdirectory is your project folder. There is no container and you are working on just a standaloneJava application.

Start Server

In IDE

create a Java application that main class is com.networknt.server.Server and workingdirectory is your project root folder. You can debug your server just like a POJO application.

From Maven

mvn exec:exec

Command Line

java -jar target/demo-0.1.0.jar

Stop Server

you can use Ctrl+C to kill the server but for production use the following command

kill -s TERM <pid>

The server has a shutdown hook and the above command allow it to clean up. For example,complete in-flight requests and close the database connections etc. If service registryand discovery is used, then the server will send shutdown event to service registry andkeep processing requests for 30 seconds until all clients refreshes their local cachebefore shutting down.

Appreciation

License

Light-4j and all light-*-4j frameworks are available under the Apache 2.0 license. See the LICENSEfile for more info.

  • 安装dcm4chee-arc-light-5.4.1-mysql步骤 一.进入网址: https://github.com/dcm4che/dcm4chee-arc-light/wiki/Installation 这个是GitHub上面给的步骤,可能会比较难理解,按照所给的步骤做,可能会出现各种问题,在此将笔者遇见的问题列举出来,并给出解决方案。 二.安装所需环境: 1、JDK 1.8.0_91 

  • 安装依赖 sudo apt-get install --no-install-recommends git cmake build-essential libboost-dev libboost-system-dev libboost-filesystem-dev 安装库 pip install setuptools wheel numpy scipy scikit-learn -U 安装GPU版

  • Turn Off The Light Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)   Problem Description There are n lights aligned in a row. These lights are numbered 1 to n from

  • 1.安装环境 系统 MacOS Mojave 版本10.14.2 Xcode 10.1 $ clang -v Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.2.0 Thread model: posix 2.错误安装 直接使用命令: pip install lightgbm 使用时直接调

 相关资料
  • Light 4J 是一个快速、轻量级和高效的微服务框架。 特性: 快速,且占用内存较小,可降低生产成本 提供嵌入式网关以解决跨领域问题 设计和测试驱动开发,以提高生产力 内置 DevOps 流程以支持持续集成到生产中 多个框架用于不同类型的微服务 支持多种语言 OAuth2 服务器、门户和服务形成生态系统

  • 光源的基类 - 所有其他的光类型都继承了该类描述的属性和方法。 构造器(Constructor) Light( color : Integer, intensity : Float ) color - (可选参数) 16进制表示光的颜色。 缺省值 0xffffff (白色)。 intensity - (可选参数) 光照强度。 缺省值 1。 创造一个新的光源。注意,这并不是直接调用的(而是使用派生类

  • The light component defines the entity as a source of light. Light affects all materials that have not specified a flat shading model with shader: flat. Note that lights are computationally expensive

  • A light client is a process that connects to the Tendermint Full Node(s) and then tries to verify the Merkle proofs about the blockchain application. In this document we describe mechanisms that ensur

  • A light changes the lighting and shading of the scene. Examples <!-- Red directional light shining from the top left. --><a-light color="red" position="-1 1 0"></a-light><!-- Blue point light, 5 meter

  • pan-light 是一款不限速的百度网盘客户端, 基于 golang + Qt5 开发. 本项意义在于探究 golang 在图形界面客户端; web 服务端; 事件调度, websocket, p2p 长连接 等方面的应用和实践. 欢迎广大 golang 开发者参与本项目. 特性 利用golang轻量级协程, 高并发分段下载, 可通过调节并发数达到最佳下载速度; 下载进度状态数据持久化到磁盘,