DLang and Golang web framework benchmarks!

zoujiaqing zoujiaqing at gmail.com
Sat May 14 21:42:26 UTC 2022


Yesterday I tested the latest version of Fasthttp and Archttp 
performance. (In my Debian virtual machine.)

## Listen port
  * Archttp :8080
  * Fasthttp :8081

## Compiler version
  * LDC 1.27
  * Golang 1.18

## Simple code for benchmarks
Archttp:
```D
import archttp;

void main(string[] args)
{
     Archttp app = new Archttp;

     app.Bind(8080);

     app.Get("/", (context) {
         auto response = context.response();
         response.body("Hello, World!");
     });

     app.Run();
}

```

Fasthttp:
```go
package main

import (
     "fmt"
     "github.com/buaazp/fasthttprouter"
     "github.com/valyala/fasthttp"
)

func Index(ctx *fasthttp.RequestCtx) {
     fmt.Fprint(ctx, "Hello world .)")
}

func main() {
     router := fasthttprouter.New()
     router.GET("/", Index)
     fasthttp.ListenAndServe(":8081", router.Handler)
}
```

## Results
```txt
Last login: Sat May 14 14:05:58 on ttys012
zoujiaqing at mac ~ % wrk -t8 -c100 -d5s --latency 
http://192.168.119.128:8081
Running 5s test @ http://192.168.119.128:8081
   8 threads and 100 connections
   Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency     4.59ms  583.21us  11.55ms   74.52%
     Req/Sec     2.62k   108.28     2.81k    77.45%
   Latency Distribution
      50%    4.53ms
      75%    4.90ms
      90%    5.30ms
      99%    6.17ms
   106510 requests in 5.10s, 15.13MB read
Requests/sec:  20869.73
Transfer/sec:      2.97MB
zoujiaqing at mac ~ % wrk -t8 -c100 -d5s --latency 
http://192.168.119.128:8080
Running 5s test @ http://192.168.119.128:8080
   8 threads and 100 connections
   Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency     4.60ms    2.06ms  40.65ms   79.75%
     Req/Sec     2.66k   184.97     2.93k    89.22%
   Latency Distribution
      50%    4.15ms
      75%    5.30ms
      90%    7.05ms
      99%   11.77ms
   108005 requests in 5.10s, 11.85MB read
Requests/sec:  21165.06
Transfer/sec:      2.32MB
zoujiaqing at mac ~ % wrk -t8 -c100 -d5s --latency 
http://192.168.119.128:8081
Running 5s test @ http://192.168.119.128:8081
   8 threads and 100 connections
   Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency     4.73ms    1.14ms  23.42ms   88.25%
     Req/Sec     2.56k   208.52     2.92k    83.29%
   Latency Distribution
      50%    4.57ms
      75%    4.99ms
      90%    5.55ms
      99%    9.26ms
   103703 requests in 5.10s, 14.74MB read
Requests/sec:  20321.51
Transfer/sec:      2.89MB
zoujiaqing at mac ~ % wrk -t8 -c100 -d5s --latency 
http://192.168.119.128:8080
Running 5s test @ http://192.168.119.128:8080
   8 threads and 100 connections
   Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency     4.51ms    1.88ms  22.04ms   77.43%
     Req/Sec     2.70k   111.17     2.97k    80.88%
   Latency Distribution
      50%    4.12ms
      75%    5.23ms
      90%    6.85ms
      99%   11.00ms
   109516 requests in 5.10s, 12.01MB read
Requests/sec:  21463.54
Transfer/sec:      2.35MB
zoujiaqing at mac ~ %
```

## More ..
At least in my Debian virtual machine Archttp behaves very close 
to Fasthttp! Even better than Fasthttp! I hope DLang can develop 
better in the field of microservices in the future.

I just released the first test version of Archttp:
https://forum.dlang.org/thread/jckjrgnmgsulewnrefpr@forum.dlang.org

I just passed the test on macOS and Linux! I will continue to 
optimize Archttp's performance and cross-platform capabilities in 
the future. We hope you can give us some optimization suggestions 
to make DLang Web framework performance better.


More information about the Digitalmars-d mailing list