Created
January 22, 2022 18:13
-
-
Save mauricio/987dfe3a2d9f908ad2c6cf04c0c7bc0c to your computer and use it in GitHub Desktop.
golang/ruby async fibers benchmark
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
root@ubuntu-c-4-8gib-nyc1-01:~# ab -n 10000 -c 50 http://159.223.163.7:3000/ | |
This is ApacheBench, Version 2.3 <$Revision: 1843412 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 159.223.163.7 (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests | |
Completed 6000 requests | |
Completed 7000 requests | |
Completed 8000 requests | |
Completed 9000 requests | |
Completed 10000 requests | |
Finished 10000 requests | |
Server Software: | |
Server Hostname: 159.223.163.7 | |
Server Port: 3000 | |
Document Path: / | |
Document Length: 3 bytes | |
Concurrency Level: 50 | |
Time taken for tests: 0.533 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Total transferred: 1190000 bytes | |
HTML transferred: 30000 bytes | |
Requests per second: 18753.11 [#/sec] (mean) | |
Time per request: 2.666 [ms] (mean) | |
Time per request: 0.053 [ms] (mean, across all concurrent requests) | |
Transfer rate: 2179.32 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 1 0.3 1 1 | |
Processing: 0 2 0.9 2 8 | |
Waiting: 0 2 0.9 2 6 | |
Total: 1 3 0.7 3 8 | |
Percentage of the requests served within a certain time (ms) | |
50% 3 | |
66% 3 | |
75% 3 | |
80% 3 | |
90% 3 | |
95% 4 | |
98% 4 | |
99% 5 | |
100% 8 (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
root@ubuntu-c-4-8gib-nyc1-01:~# ab -n 10000 -c 50 http://159.223.163.7:3000/ | |
This is ApacheBench, Version 2.3 <$Revision: 1843412 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 159.223.163.7 (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests | |
Completed 6000 requests | |
Completed 7000 requests | |
Completed 8000 requests | |
Completed 9000 requests | |
Completed 10000 requests | |
Finished 10000 requests | |
Server Software: | |
Server Hostname: 159.223.163.7 | |
Server Port: 3000 | |
Document Path: / | |
Document Length: 3 bytes | |
Concurrency Level: 50 | |
Time taken for tests: 1.578 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Total transferred: 410000 bytes | |
HTML transferred: 30000 bytes | |
Requests per second: 6336.65 [#/sec] (mean) | |
Time per request: 7.891 [ms] (mean) | |
Time per request: 0.158 [ms] (mean, across all concurrent requests) | |
Transfer rate: 253.71 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 1 0.3 1 2 | |
Processing: 1 7 2.5 7 22 | |
Waiting: 0 3 2.1 3 15 | |
Total: 1 8 2.5 7 22 | |
Percentage of the requests served within a certain time (ms) | |
50% 7 | |
66% 8 | |
75% 8 | |
80% 8 | |
90% 11 | |
95% 15 | |
98% 16 | |
99% 16 | |
100% 22 (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
package main | |
import ( | |
"net/http" | |
) | |
func home(w http.ResponseWriter, r *http.Request) { | |
w.WriteHeader(http.StatusOK) | |
w.Write([]byte("Yo!")) | |
} | |
func main() { | |
http.HandleFunc("/", home) | |
http.ListenAndServe(":3000", nil) | |
} |
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
# ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-linux] | |
require 'async' # async (1.30.1) | |
require 'async/http/server' # async-http (0.56.5) | |
require 'async/http/client' | |
require 'async/http/endpoint' | |
require 'async/http/protocol/response' | |
endpoint = Async::HTTP::Endpoint.parse('http://0.0.0.0:3000') | |
app = lambda do |request| | |
Protocol::HTTP::Response[200, {}, ["Yo!"]] | |
end | |
server = Async::HTTP::Server.new(app, endpoint) | |
Async do |task| | |
server_task = task.async do | |
server.run | |
end | |
server_task.wait | |
end |
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
Linux ubuntu-c-4-8gib-nyc1-01 5.4.0-94-generic #106-Ubuntu SMP Thu Jan 6 23:58:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux | |
8 GB Memory / 50 GB Disk / NYC1 - Ubuntu 20.04 (LTS) x64 | |
Packages: | |
0: Intel Xeon Gold 6140 | |
1: Intel Xeon Gold 6140 | |
2: Intel Xeon Gold 6140 | |
3: Intel Xeon Gold 6140 | |
Cores: | |
0: 1 processor (0), Intel Sky Lake | |
1: 1 processor (1), Intel Sky Lake | |
2: 1 processor (2), Intel Sky Lake | |
3: 1 processor (3), Intel Sky Lake | |
Logical processors: | |
0: APIC ID 0x00000000 | |
1: APIC ID 0x00000001 | |
2: APIC ID 0x00000002 | |
3: APIC ID 0x00000003 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment