Wrap text
|
|
require 'rubygems'
require 'eventmachine'
require 'evma_httpserver'
class Handler < EventMachine::Connection
include EventMachine::HttpServer
def process_http_request
resp = EventMachine::DelegatedHttpResponse.new( self )
resp.keep_connection_open(false)
resp.status = 200
resp.content = "{}"
resp.send_response
end
end
EventMachine.epoll
EventMachine::run {
EventMachine::start_server("0.0.0.0", 8082, Handler)
puts "Listening..."
}
###############################
#[root@localhost ftw]# httperf --server=localhost --port=8082 --uri=/ --num-conns=10000 --rate=1000 -v
#httperf --verbose --client=0/1 --server=localhost --port=8082 --uri=/ --rate=1000 --send-buffer=4096 --recv-buffer=16384 --num-conns=10000 --num-calls=1
#httperf: maximum number of open descriptors = 1024
#reply-rate = 1000.0
#Maximum connect burst length: 56
#
#Total: connections 10000 requests 10000 replies 10000 test-duration 9.999 s
#
#Connection rate: 1000.1 conn/s (1.0 ms/conn, <=91 concurrent connections)
#Connection time [ms]: min 0.2 avg 6.0 max 78.3 median 0.5 stddev 13.4
#Connection time [ms]: connect 2.4
#Connection length [replies/conn]: 1.000
#
#Request rate: 1000.1 req/s (1.0 ms/req)
#Request size [B]: 62.0
#
#Reply rate [replies/s]: min 1000.0 avg 1000.0 max 1000.0 stddev 0.0 (1 samples)
#Reply time [ms]: response 3.7 transfer 0.0
#Reply size [B]: header 39.0 content 2.0 footer 0.0 (total 41.0)
#Reply status: 1xx=0 2xx=10000 3xx=0 4xx=0 5xx=0
#
#CPU time [s]: user 0.36 system 5.93 (user 3.6% system 59.3% total 63.0%)
#Net I/O: 100.6 KB/s (0.8*10^6 bps)
#
#Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
#Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
|