G-WAN Web Server – Installation and Test with Apache Bench

Global WAN(G-WAN) is a web server developed by Pierre Gauthier.
It is written in C and is one of the fastest static web server I’ve ever tested with Apache Bench.

# create the download and build directory
mkdir -p ~/build/gwan
cd ~/build/gwan

sudo apt-get install -y sqlite3 libtokyocabinet-dbg libtokyocabinet-dev tokyocabinet-bin gobjc++
# install Go language
sudo apt-get install -y golang
# link go lang binary
sudo mkdir -p  /usr/local/go/bin/
sudo ln -s /usr/bin/go /usr/local/go/bin/go

# download gwan binaries
wget http://gwan.com/archives/gwan_linux64-bit.tar.bz2
tar -xjf gwan_linux64-bit.tar.bz2
cd gwan_linux64-bit

sudo JAVA_HOME=/usr/lib/jvm/java-7-oracle ./gwan

#loading..
#             loan.cs: to use   .cs scripts, install C#.
#            hello.js: to use   .js scripts, install Javascript..
#            hello.go: to use   .go scripts, install Go.
#            hello.cs: to use   .cs scripts, install C#...
#             argv.cs: to use   .cs scripts, install C#
#
#G-WAN 4.3.14 (pid:21021)

# firefox http://localhost:8080/
#sudo ab -n100000 -c1000 http://localhost:8080/

Set Java Environment


# example 1.
sudo sh -c 'echo "JAVA_HOME=\"/usr/lib/jvm/java-7-oracle\"" >> /etc/environment'

# example 2. Setting JAVA_HOME and PATH for a single user
vi ~/.bash_profile
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export PATH=$PATH:$JAVA_HOME/bin

# example 3. Setting JAVA_HOME and PATH for all users
vi /etc/profile

export JAVA_HOME=/opt/jdkx.x.x_xx
export PATH=$PATH:$JAVA_HOME/bin

Simple Apache Bench Test


sudo ab -t60 -c20000  http://localhost:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:        G-WAN
Server Hostname:        localhost
Server Port:            8080

Document Path:          /
Document Length:        7497 bytes

Concurrency Level:      20000
Time taken for tests:   5.965 seconds
Complete requests:      50000
Failed requests:        0
Write errors:           0
Total transferred:      388600000 bytes
HTML transferred:       374850000 bytes
Requests per second:    8382.35 [#/sec] (mean)
Time per request:       2385.965 [ms] (mean)
Time per request:       0.119 [ms] (mean, across all concurrent requests)
Transfer rate:          63620.75 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      430  970 298.5    997    2228
Processing:   427 1023 441.5   1054    2215
Waiting:      211  705 366.7    653    1574
Total:       1235 1993 477.5   1965    3499

Percentage of the requests served within a certain time (ms)
  50%   1965
  66%   2335
  75%   2340
  80%   2347
  90%   2483
  95%   2703
  98%   3449
  99%   3472
 100%   3499 (longest request)

References

1. Home: http://gwan.ch
2. Manual: http://gwan.ch/archives/gwan_linux.pdf
3. Example: http://riccardotacconi.blogspot.de/2012/06/how-to-install-g-wan-on-ubuntu-1004-32.html
4. Benchmark: http://www.gwan.ch/benchmark