ruby sinatra web 开发框架

-bash-3.2$ vi hi.rb
require 'rubygems'
require 'sinatra'


get '/hi' do
  "Hello World!"
end
~



-bash-3.2$ ruby hi.rb 

== Sinatra/1.3.1 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024

>> Listening on 0.0.0.0:4567, CTRL+C to stop
ruby sinatra web 开发框架_第1张图片

ruby sinatra web 开发框架_第2张图片

-bash-3.2$ ruby hi.rb 
== Sinatra/1.3.1 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
202.38.128.168 - - [23/Dec/2011 13:19:55] "GET / HTTP/1.1" 404 440 0.0008
202.38.128.168 - - [23/Dec/2011 13:19:56] "GET /__sinatra__/404.png HTTP/1.1" 200 23305 0.0020
202.38.128.168 - - [23/Dec/2011 13:19:59] "GET /favicon.ico HTTP/1.1" 404 451 0.0007
202.38.128.168 - - [23/Dec/2011 13:47:41] "GET / HTTP/1.1" 404 440 0.0013
202.38.128.168 - - [23/Dec/2011 13:47:41] "GET /favicon.ico HTTP/1.1" 404 451 0.0006
202.38.128.168 - - [23/Dec/2011 13:47:50] "GET /hi HTTP/1.1" 200 12 0.0005
202.38.128.168 - - [23/Dec/2011 13:47:55] "GET /favicon.ico HTTP/1.1" 404 451 0.0006



性能测试


# ab -n 1000 http://localhost:4567/hi
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 localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests




Server Software:        thin
Server Hostname:        localhost
Server Port:            4567


Document Path:          /hi
Document Length:        12 bytes


Concurrency Level:      1
Time taken for tests:   3.139 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      216000 bytes
HTML transferred:       12000 bytes
Requests per second:    318.58 [#/sec] (mean)
Time per request:       3.139 [ms] (mean)
Time per request:       3.139 [ms] (mean, across all concurrent requests)
Transfer rate:          67.20 [Kbytes/sec] received


Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1    3  38.3      1    1068
Waiting:        1    3  38.3      1    1068
Total:          1    3  38.3      1    1068


Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      1
  99%     26
 100%   1068 (longest request)
[root@prfserver01 ~]# ab --help




--------------------------------------------------------------------------

opennebula sunstone 使用这个框架开发的
性能测试

-bash-3.2$ ab -n 100 http://localhost:9869/
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 localhost (be patient).....done




Server Software:        thin
Server Hostname:        localhost
Server Port:            9869


Document Path:          /
Document Length:        1518 bytes


Concurrency Level:      1
Time taken for tests:   0.131 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      172400 bytes
HTML transferred:       151800 bytes
Requests per second:    764.06 [#/sec] (mean)
Time per request:       1.309 [ms] (mean)
Time per request:       1.309 [ms] (mean, across all concurrent requests)
Transfer rate:          1286.37 [Kbytes/sec] received


Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1    1   3.8      1      39
Waiting:        1    1   3.8      1      39
Total:          1    1   3.8      1      39


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



================================================
Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort:

DSL : domain specific language

你可能感兴趣的:(apache,Web,processing,Ruby,rubygems,Sinatra)