{"id":14983074,"url":"https://github.com/esastack/esa-restlight","last_synced_at":"2025-04-09T12:08:09.947Z","repository":{"id":39714727,"uuid":"318442379","full_name":"esastack/esa-restlight","owner":"esastack","description":"A lightweight and rest-oriented web framework.","archived":false,"fork":false,"pushed_at":"2022-07-28T10:17:17.000Z","size":6988,"stargazers_count":152,"open_issues_count":16,"forks_count":36,"subscribers_count":1,"default_branch":"0.x","last_synced_at":"2025-04-02T10:14:18.218Z","etag":null,"topics":["asynchronous","completionsage","h2c","haproxy","http2","https","jaxrs","netty","spring-boot","springmvc","thread-scheduling"],"latest_commit_sha":null,"homepage":"https://restlight.esastack.io/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esastack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-04T07:48:20.000Z","updated_at":"2025-02-28T04:32:44.000Z","dependencies_parsed_at":"2022-09-20T08:35:38.177Z","dependency_job_id":null,"html_url":"https://github.com/esastack/esa-restlight","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esastack%2Fesa-restlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esastack%2Fesa-restlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esastack%2Fesa-restlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esastack%2Fesa-restlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esastack","download_url":"https://codeload.github.com/esastack/esa-restlight/tar.gz/refs/heads/0.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036067,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","completionsage","h2c","haproxy","http2","https","jaxrs","netty","spring-boot","springmvc","thread-scheduling"],"created_at":"2024-09-24T14:06:41.406Z","updated_at":"2025-04-09T12:08:09.928Z","avatar_url":"https://github.com/esastack.png","language":"Java","funding_links":[],"categories":["开发框架"],"sub_categories":[],"readme":"# Restlight\n\n![Build](https://github.com/esastack/esa-restlight/workflows/Build/badge.svg?branch=main)\n[![codecov](https://codecov.io/gh/esastack/esa-restlight/branch/main/graph/badge.svg?token=CCQBCBQJP6)](https://codecov.io/gh/esastack/esa-restlight)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.esastack/restlight-parent/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.esastack/restlight-parent/)\n[![GitHub license](https://img.shields.io/github/license/esastack/esa-restlight)](https://github.com/esastack/esa-restlight/blob/main/LICENSE)\n\nRestlight is a lightweight and rest-oriented web framework.\n\n## Features\n\n- HTTP1.1/HTTP2/H2C/HTTPS support\n- SpringMVC and JAX-RS annotations support\n- High performance: 2 to 4 times Spring Web\n- Fully asynchronous: Based on `CompletableFuture`\n- Threading Model: Connector thread, IO thread, Biz thread\n- Thread Scheduling: Schedule requests to IO thread pool, Biz thread pool, or any custom thread pool\n- Self-Protection: Connection creation limit, CPU load overload protection\n- Spring Boot Actuator support\n- Extension: Use SPI(enhanced) to extend Restlight\n- Layered architecture: Use Restlight in Spring Boot, Spring, and embedded environment without compatibility issues\n- more...\n\n## Quick Start\n\nCreate a Spring Boot application and add dependency\n\n\u003e **Note：`netty` 4.1.52.Final and `tcnative` 2.0.34.Final are directly dependent on.**\n\n\u003e **Note: Please make sure the version of `tcnative` matches the version of `netty`.**\n \n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.esastack\u003c/groupId\u003e\n    \u003cartifactId\u003erestlight-starter\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nWrite your Controller\n\n```java\n@RestController\n@SpringBootApplication\npublic class RestlightDemoApplication {\n\n    @GetMapping(\"/hello\")\n    public String hello() {\n        return \"Hello Restlight!\";\n    }\n\n    public static void main(String[] args) {\n        SpringApplication.run(RestlightDemoApplication.class, args);\n    }\n}\n```\n\nRun your application and then you would see something like\n\n```\nStarted Restlight server in 1265 millis on 0.0.0.0:8080\n```\n\ncurl http://localhost:8080/hello \n\n## Performance\n\n### Test cases\n\n- We built an echo server by ESA Restlight and used a http client to do the requests for RPS testing with different bytes of payload(16B, 128B, 512B, 1KB, 4KB, 10KB) and different Threading-Models(IO, BIZ).\n- Also we used `spring-boot-starter-web`(2.3.2.RELEASE) to build a server which is same with above for RPS testing.\n\n### Hardware Used\n\nWe used the following software for the testing:\n\n- wrk4.1.0\n\n- |        | OS                       | CPU  | Mem(G) |\n  | ------ | ------------------------ | ---- | ------ |\n  | server | centos:6.9-1.2.5(docker) | 4    | 8      |\n  | client | centos:7.6-1.3.0(docker) | 16   | 3      |\n  \n\n### JVM Options\n\n```\n-server -Xms3072m -Xmx3072m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:+UseConcMarkSweepGC -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+PrintTenuringDistribution -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc-${appName}-%t.log -XX:NumberOfGCLogFiles=20 -XX:GCLogFileSize=480M -XX:+UseGCLogFileRotation -XX:HeapDumpPath=.\n```\n\n### Server Options\n\n| Framework  | Options                                                      |\n| ---------- | ------------------------------------------------------------ |\n| Restlight  | restlight.server.io-threads=8\u003cbr/\u003erestlight.server.core-biz-threads=16\u003cbr/\u003erestlight.server.max-biz-threads=16\u003cbr/\u003erestlight.server.blocking-queue-length=512 |\n| Spring Web | server.tomcat.threads.max=32\u003cbr/\u003eserver.tomcat.accept-count=128 |\n\n\n\n### RPS\n\n|                | 16B       | 128B      | 512B      | 1KB       | 4KB      | 10KB     |\n| -------------- | --------- | --------- | --------- | --------- | -------- | -------- |\n| Restlight(IO)  | 129457.26 | 125344.89 | 125206.74 | 116963.24 | 85749.45 | 49034.57 |\n| Restlight(BIZ) | 101385.44 | 98786.62  | 97622.33  | 96504.81  | 68235.2  | 46460.79 |\n| Spring Web     | 35648.27  | 38294.94  | 37940.3   | 37497.58  | 32098.65 | 22074.94 |\n\n#### See more details in [Reference Doc](https://www.esastack.io/esa-restlight)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesastack%2Fesa-restlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesastack%2Fesa-restlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesastack%2Fesa-restlight/lists"}