Skip to content

Repository files navigation

ESA HttpServer

BuildcodecovMaven CentralGitHub license

ESA HttpServer is an asynchronous event-driven http server based on netty.

Features

  • Asynchronous request handing
  • Http1/H2/H2cUpgrade
  • Https
  • HAProxy
  • Epoll/NIO
  • Chunked read/write
  • Body aggregation
  • Multipart
  • Metrics
  • more features...

Maven Dependency

<dependency>
<groupId>io.esastack</groupId>
<artifactId>httpserver</artifactId>
<version>${mvn.version}</version>
</dependency>

Quick Start

HttpServer.create()
.handle(req -> {
req.onData(buf -> {
// handle http content 
});
req.onEnd(p -> {
req.response()
.setStatus(200)
.end("Hello ESA Http Server!".getBytes());
returnp.setSuccess(null);
});
})
.listen(8080)
.awaitUninterruptibly();

Performance

Test cases

  • We built an echo server by ESA HttpServer and used a http client to do the requests for RPS testing with different bytes payload(16B, 128B, 512B, 1KB, 4KB, 10KB)
  • Also we used origin netty to build a server which is same with above for RPS testing (uses the HttpServerCodec, HttpObjectAggregator handlers directly).

Hardware Used

We used the following software for the testing:

  • wrk4.1.0

  • OSCPUMem(G)
    servercentos:6.9-1.2.5(docker)48
    clientcentos:7.6-1.3.0(docker)163

JVM Options

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

Server Options

  • we set the value of IO threads to 8.

RPS

16B128B512B1KB4KB10KB
Netty133272.34132818.53132390.78127366.2885408.749798.84
ESA HttpServer142063.99139608.23139646.04140159.592767.5353534.21

About

An asynchronous event-driven HTTP server based on netty.

Topics

Resources

Contributing

Stars

89 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages