ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux-gnu]
go version xgcc (Ubuntu 4.9.1-0ubuntu1) 4.9.1 linux/amd64
require 'sinatra'
require 'thin'
set :logging, false
set :bind, '0.0.0.0'
get '/' do
'{"message":"Hello, World!"}'
end
module MySinatra
class Application
def self.call(env)
new.call(env)
end
def call(env)
headers = { 'Content-Type' => 'text/plain' }
if env['PATH_INFO'] == '/'
status, body = 200, '{"message":"Hello, World!"}'
else
status, body = 404, "Sinatra doesn't know this ... ! "
end
headers['Content-Length'] = body.length.to_s
[status, headers, [body] ]
end
end
end
require 'thin'
Thin::Server.start MySinatra::Application, 4567
go bee (http://beego.me/quickstart)
package main
import (
"github.com/astaxie/beego"
)
type MainController struct {
beego.Controller
}
func (this *MainController) Get() {
this.Ctx.WriteString("{\"message\":\"Hello, World!\"}")
}
func main() {
beego.Router("/", &MainController{})
beego.Run()
}
package main
import (
"io"
"net/http"
"log"
)
// hello world, the web server
func HelloServer(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "{\"message\":\"Hello, World!\"}")
}
func main() {
http.HandleFunc("/hello", HelloServer)
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
AWS EC2 c3.large
use 1 cpu
rake
wrk -c 100 -d 30s http://172.31.39.36:4567
wrk -c 100 -d 60s http://172.31.39.36:4567
wrk -c 200 -d 60s http://172.31.39.36:4567
wrk -c 300 -d 60s http://172.31.39.36:4567