Skip to content

A simple web benchmark of Go, Rust, D, Scala, Node.js and Crystal.

License

Notifications You must be signed in to change notification settings

uicuxd/simple-web-benchmark

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Web Benchmark

A simple web benchmark of Go, Crystal, Rust, D, Scala, Node.js and Crystal.

Preliminary Results

MacOS

OS: Mac OS X 10.13.3

Hardware: MacBook Pro (CPU: 2.3 GHz Intel Core i7, Mem: 16 GB 1600 MHz DDR3)

Software: Go 1.9.3, Rust 1.25.0-nightly, Scala 2.12.4, Node.js 9.4.0, DMD 2.078.1, LDC 1.7.0, Crystal 0.24.1, PHP 7.1.13.

Windows 10

OS: Microsoft Windows [Version 10.0.15063]

Hardware: Dell XPS (CPU: 2.6 GHz Intel Core i7, Mem: 16 GB 2133 MHz DDR4)

Software: Go 1.9.3, Rust 1.25.0-nightly, Scala 2.12.4, Node.js 9.4.0, DMD 2.078.1, LDC 1.7.0, Crystal 0.24.1 (under WSL).

WSL

OS: 4.4.0-43-Microsoft GNU/Linux

Hardware: Dell XPS (CPU: 2.6 GHz Intel Core i7, Mem: 16 GB 2133 MHz DDR4)

Software: Go 1.9.2, Rust 1.25.0-nightly, Scala 2.12.4, Node.js 9.4.0, DMD 2.078.1, LDC 1.7.0, Crystal 0.24.1, PHP 7.0.22.

Testing

The stats gathered by the hey tool (please run it twice for the JIT optimizations where it's applicable):

hey -n 50000 -c 256 -t 10 "http://127.0.0.1:3000/"
hey -n 50000 -c 256 -t 10 "http://127.0.0.1:3000/greeting/hello"

MacOS Note

By default, MacOS has low limits on the number of concurrent connections, so few kernel parameters tweaks may be required:

sudo sysctl -w kern.ipc.somaxconn=12000
sudo sysctl -w kern.maxfilesperproc=1048576
sudo sysctl -w kern.maxfiles=1148576

Automation

Please use the Scala script (using sbt Script runner) to run all the tests automatically.

Usage: scalas suite/run.scala [options] <lang>...

  -o, --out <file>  image file to generate (result.png by default)
  --verbose         verbose execution output
  <lang>...         languages to test ('all' for all)

The following languages are supported: rust_hyper, rust_rocket, crystal, nodejs, go, scala, dmd, ldc2.

Usage

Go

go run go/main.go

Crystal

Using Crystal:

crystal run --release --no-debug crystal/server.cr

Alpine Linux note: please use crystal-alpine packages.

macOS note: linking with OpenSSL may require PKG_CONFIG_PATH changes.

Rust

Please install Nightly Rust. Windows also requires MinGW compiler toolchain with mingw-w64-x86_64-gcc installed.

Sample applications use hyper HTTP library and Rocket web framework:

cargo run --manifest-path rust/hyper/Cargo.toml --release
cargo run --manifest-path rust/rocket/Cargo.toml --release

D

Two compilers are tested:

  • DMD (a reference D compiler);
  • LDC (LLVM-based D compiler). If ldc2 executable is not in path, please use the fully qualified path name.

Uses vibe.d framework:

dub run --root=d --compiler=dmd --build=release --config=dmd
dub run --root=d --compiler=ldc2 --build=release --config=ldc

Scala

Uses Akka toolkit:

gradle -p scala run --info

Node.js

node nodejs/main.js

PHP

Uses standalone web server and Swoole extension:

php -S 127.0.0.1:3000 php/bare/main.php
php -c php/swoole/php.ini php/swoole/main.php

Python

python3 python/main.py

Java

Uses Sprint Boot project:

gradle -p java build
java -jar -Dserver.port=3000 java/build/libs/java-0.0.1-SNAPSHOT.jar

About

A simple web benchmark of Go, Rust, D, Scala, Node.js and Crystal.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 52.1%
  • Rust 11.7%
  • Dockerfile 6.8%
  • JavaScript 6.3%
  • Python 5.1%
  • PHP 4.5%
  • Other 13.5%