«   2018/12   »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Archives
Today
26
Total
1,189,181
안정적인 DNS서비스 DNSEver
관리 메뉴

Blue Breeze

Ruby helloWorld 본문

Language/Ruby

Ruby helloWorld

푸른바람 C/H 2018.06.09 16:44

Ruby

require 'socket'
server = TCPServer.new 1337

while session = server.accept
    request = session.gets
    puts request

    session.print "HTTP/1.1 200\r\n" # 1
    session.print "Content-Type: text/html\r\n" # 2
    session.print "\r\n" # 3
    session.print "Hello world" #4

    session.close
end
ruby server.rb

# other terminal
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
.....
Concurrency Level:      10
Time taken for tests:   0.470 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      520000 bytes
HTML transferred:       110000 bytes
Requests per second:    21257.96 [#/sec] (mean)
Time per request:       0.470 [ms] (mean)
Time per request:       0.047 [ms] (mean, across all concurrent requests)
Transfer rate:          1079.51 [Kbytes/sec] received

Connection Times (ms)
                min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:     0    0   0.2      0       2
Waiting:        0    0   0.2      0       2
Total:          0    0   0.2      0       3

Percentage of the requests served within a certain time (ms)
    50%      0
    66%      0
    75%      0
    80%      0
    90%      1
    95%      1
    98%      1
    99%      2
    100%      3 (longest request)


'Language > Ruby' 카테고리의 다른 글

Ruby JSON multiJson activeSupport  (0) 2018.06.21
Ruby JSON multiJson oj  (0) 2018.06.20
Ruby helloWorld  (0) 2018.06.09
RadRails와 Eclipse로 Ruby on Rails를 쉽게! (한글)  (0) 2007.05.13
RoR(Ruby on Rails)  (0) 2006.10.26
0 Comments
댓글쓰기 폼