Last active
December 31, 2015 12:09
-
-
Save anarcher/7984301 to your computer and use it in GitHub Desktop.
D(vibe.d) vs Go For Simple HTTP Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Using DMD | |
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 127.0.0.1 (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: vibe.d/0.7.18 | |
Server Hostname: 127.0.0.1 | |
Server Port: 8080 | |
Document Path: / | |
Document Length: 13 bytes | |
Concurrency Level: 1000 | |
Time taken for tests: 4.382 seconds | |
Complete requests: 50000 | |
Failed requests: 0 | |
Write errors: 0 | |
Total transferred: 7650000 bytes | |
HTML transferred: 650000 bytes | |
Requests per second: 11410.20 [#/sec] (mean) | |
Time per request: 87.641 [ms] (mean) | |
Time per request: 0.088 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1704.84 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 18 129.7 0 1001 | |
Processing: 4 31 248.8 8 3311 | |
Waiting: 2 31 248.8 8 3311 | |
Total: 7 49 348.8 8 4309 | |
Percentage of the requests served within a certain time (ms) | |
50% 8 | |
66% 8 | |
75% 8 | |
80% 9 | |
90% 10 | |
95% 11 | |
98% 56 | |
99% 1228 | |
100% 4309 (longest request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$export GOMAXPROCS=1 | |
$go version | |
go version go1.0.3 | |
$ab -c 1000 -n 50000 http://127.0.0.1:8081/ | |
Finished 50000 requests | |
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 8081 | |
Document Path: / | |
Document Length: 13 bytes | |
Concurrency Level: 1000 | |
Time taken for tests: 5.653 seconds | |
Complete requests: 50000 | |
Failed requests: 0 | |
Write errors: 0 | |
Total transferred: 6500000 bytes | |
HTML transferred: 650000 bytes | |
Requests per second: 8845.32 [#/sec] (mean) | |
Time per request: 113.054 [ms] (mean) | |
Time per request: 0.113 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1122.94 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 1 31 141.5 11 1017 | |
Processing: 5 16 36.6 15 5607 | |
Waiting: 3 12 36.6 10 5607 | |
Total: 12 47 148.8 26 5613 | |
Percentage of the requests served within a certain time (ms) | |
50% 26 | |
66% 31 | |
75% 34 | |
80% 35 | |
90% 38 | |
95% 41 | |
98% 1019 | |
99% 1033 | |
100% 5613 (longest request) | |
$ ~/tools/go/bin/go version | |
go version go1.2 linux/amd64 | |
ab -c 1000 -n 50000 http://127.0.0.1:8081/ | |
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 127.0.0.1 (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: | |
Server Hostname: 127.0.0.1 | |
Server Port: 8081 | |
Document Path: / | |
Document Length: 13 bytes | |
Concurrency Level: 1000 | |
Time taken for tests: 2.604 seconds | |
Complete requests: 50000 | |
Failed requests: 0 | |
Write errors: 0 | |
Total transferred: 6500000 bytes | |
HTML transferred: 650000 bytes | |
Requests per second: 19204.84 [#/sec] (mean) | |
Time per request: 52.070 [ms] (mean) | |
Time per request: 0.052 [ms] (mean, across all concurrent requests) | |
Transfer rate: 2438.11 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 4 25 113.5 12 1017 | |
Processing: 5 17 4.7 17 232 | |
Waiting: 4 13 4.4 12 230 | |
Total: 16 42 113.9 31 1039 | |
Percentage of the requests served within a certain time (ms) | |
50% 31 | |
66% 33 | |
75% 34 | |
80% 35 | |
90% 37 | |
95% 39 | |
98% 42 | |
99% 1029 | |
100% 1039 (longest request) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vibe.d; | |
shared static this() | |
{ | |
auto settings = new HTTPServerSettings; | |
settings.port = 8080; | |
settings.bindAddresses = ["::1", "127.0.0.1"]; | |
listenHTTP(settings, &hello); | |
logInfo("Please open http://127.0.0.1:8080/ in your browser."); | |
} | |
void hello(HTTPServerRequest req, HTTPServerResponse res) | |
{ | |
res.writeBody("Hello, World!"); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"log" | |
) | |
func handler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprint(w, "Hello, world!") | |
} | |
func main() { | |
http.HandleFunc("/", handler) | |
if err := http.ListenAndServe(":8081", nil); err != nil { | |
log.Fatal("ListenAndServe: ", err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment