Created
April 28, 2015 10:52
-
-
Save jeapostrophe/f7fd1e48be19300b7b15 to your computer and use it in GitHub Desktop.
Responding to requests concurrently in the Racket Web 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
This is ApacheBench, Version 2.3 <$Revision: 1604373 $> | |
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).....done | |
Server Software: Racket | |
Server Hostname: localhost | |
Server Port: 9000 | |
Document Path: /test | |
Document Length: 50 bytes | |
Concurrency Level: 5 | |
Time taken for tests: 20.094 seconds | |
Complete requests: 50 | |
Failed requests: 0 | |
Total transferred: 11750 bytes | |
HTML transferred: 2500 bytes | |
Requests per second: 2.49 [#/sec] (mean) | |
Time per request: 2009.350 [ms] (mean) | |
Time per request: 401.870 [ms] (mean, across all concurrent requests) | |
Transfer rate: 0.57 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.1 0 0 | |
Processing: 2004 2009 2.7 2009 2017 | |
Waiting: 2004 2009 2.7 2008 2017 | |
Total: 2005 2009 2.8 2009 2017 | |
Percentage of the requests served within a certain time (ms) | |
50% 2009 | |
66% 2009 | |
75% 2010 | |
80% 2010 | |
90% 2015 | |
95% 2016 | |
98% 2017 | |
99% 2017 | |
100% 2017 (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
Your Web application is running at http://localhost:9000. | |
Stop this program at any time to terminate the Web Server. | |
REQUEST @ 1430218137 | |
REQUEST @ 1430218137 | |
REQUEST @ 1430218137 | |
REQUEST @ 1430218137 | |
REQUEST @ 1430218137 | |
RESPONSE @ 1430218139 :: #f | |
RESPONSE @ 1430218139 :: #f | |
RESPONSE @ 1430218139 :: #f | |
RESPONSE @ 1430218139 :: #f | |
RESPONSE @ 1430218139 :: #f | |
REQUEST @ 1430218139 | |
REQUEST @ 1430218139 | |
REQUEST @ 1430218139 | |
REQUEST @ 1430218139 | |
REQUEST @ 1430218139 | |
RESPONSE @ 1430218141 :: #f | |
RESPONSE @ 1430218141 :: #f | |
RESPONSE @ 1430218141 :: #f | |
RESPONSE @ 1430218141 :: #f | |
RESPONSE @ 1430218141 :: #f | |
REQUEST @ 1430218141 | |
REQUEST @ 1430218141 | |
REQUEST @ 1430218141 | |
REQUEST @ 1430218141 | |
REQUEST @ 1430218141 | |
RESPONSE @ 1430218143 :: #f | |
RESPONSE @ 1430218143 :: #f | |
RESPONSE @ 1430218143 :: #f | |
RESPONSE @ 1430218143 :: #f | |
RESPONSE @ 1430218143 :: #f | |
REQUEST @ 1430218143 | |
REQUEST @ 1430218143 | |
REQUEST @ 1430218143 | |
REQUEST @ 1430218143 | |
REQUEST @ 1430218143 | |
RESPONSE @ 1430218145 :: #f | |
RESPONSE @ 1430218145 :: #f | |
RESPONSE @ 1430218145 :: #f | |
RESPONSE @ 1430218145 :: #f | |
RESPONSE @ 1430218145 :: #f | |
REQUEST @ 1430218145 | |
REQUEST @ 1430218145 | |
REQUEST @ 1430218145 | |
REQUEST @ 1430218145 | |
REQUEST @ 1430218145 | |
RESPONSE @ 1430218147 :: #f | |
RESPONSE @ 1430218147 :: #f | |
RESPONSE @ 1430218147 :: #f | |
RESPONSE @ 1430218147 :: #f | |
RESPONSE @ 1430218147 :: #f | |
REQUEST @ 1430218147 | |
REQUEST @ 1430218147 | |
REQUEST @ 1430218147 | |
REQUEST @ 1430218147 | |
REQUEST @ 1430218147 | |
RESPONSE @ 1430218149 :: #f | |
RESPONSE @ 1430218149 :: #f | |
RESPONSE @ 1430218149 :: #f | |
RESPONSE @ 1430218149 :: #f | |
RESPONSE @ 1430218149 :: #f | |
REQUEST @ 1430218149 | |
REQUEST @ 1430218149 | |
REQUEST @ 1430218149 | |
REQUEST @ 1430218149 | |
REQUEST @ 1430218149 | |
RESPONSE @ 1430218151 :: #f | |
RESPONSE @ 1430218151 :: #f | |
RESPONSE @ 1430218151 :: #f | |
RESPONSE @ 1430218151 :: #f | |
RESPONSE @ 1430218151 :: #f | |
REQUEST @ 1430218151 | |
REQUEST @ 1430218151 | |
REQUEST @ 1430218151 | |
REQUEST @ 1430218151 | |
REQUEST @ 1430218151 | |
RESPONSE @ 1430218153 :: #f | |
RESPONSE @ 1430218153 :: #f | |
RESPONSE @ 1430218153 :: #f | |
RESPONSE @ 1430218153 :: #f | |
RESPONSE @ 1430218153 :: #f | |
REQUEST @ 1430218153 | |
REQUEST @ 1430218153 | |
REQUEST @ 1430218153 | |
REQUEST @ 1430218153 | |
REQUEST @ 1430218153 | |
RESPONSE @ 1430218155 :: #f | |
RESPONSE @ 1430218155 :: #f | |
RESPONSE @ 1430218155 :: #f | |
RESPONSE @ 1430218155 :: #f | |
RESPONSE @ 1430218155 :: #f | |
REQUEST @ 1430218155 | |
REQUEST @ 1430218155 | |
REQUEST @ 1430218155 | |
REQUEST @ 1430218155 | |
REQUEST @ 1430218155 | |
RESPONSE @ 1430218157 :: #f | |
RESPONSE @ 1430218157 :: #f | |
RESPONSE @ 1430218157 :: #f | |
RESPONSE @ 1430218157 :: #f | |
RESPONSE @ 1430218157 :: #f |
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
#lang racket/base | |
(require web-server/http | |
web-server/servlet-env) | |
(define (start req) | |
(define request-start/s (current-seconds)) | |
(printf "REQUEST @ ~a\n" request-start/s) | |
;; long I/O, fetch from a web service or some such | |
(thread-wait (thread (λ () (sleep 2)))) | |
(define request-end/s (current-seconds)) | |
(begin0 | |
(response/full | |
200 | |
#"Okay" | |
request-end/s | |
#"text/plain" | |
null | |
(list (string->bytes/utf-8 | |
(format "request/response interval ~a -> ~a" | |
request-start/s request-end/s)))) | |
(printf "RESPONSE @ ~a :: ~a\n" request-end/s #f) | |
(flush-output))) | |
(serve/servlet start | |
#:port 9000 | |
#:command-line? #t | |
#:banner? #t | |
#:listen-ip #f | |
#:servlet-regexp #rx"") |
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
% racket -t t.rkt 2>&1 | tee t.log | |
% ab -n 50 -c 5 http://localhost:9000/test 2>&1 | tee ab.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment