Skip to content

Instantly share code, notes, and snippets.

@gankkank
Last active August 29, 2015 14:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gankkank/3a59513ea81cb5ec5e33 to your computer and use it in GitHub Desktop.
Save gankkank/3a59513ea81cb5ec5e33 to your computer and use it in GitHub Desktop.

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

Sinatra

require 'sinatra'
require 'thin'

set :logging, false
set :bind, '0.0.0.0'

get '/' do
  '{"message":"Hello, World!"}'
end

rake

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
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()
}

go net/http

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)
  }
}
@gankkank
Copy link
Author

AWS EC2 c3.large

use 1 cpu

rake

wrk -c 100 -d 30s http://172.31.39.36:4567

Running 30s test @ http://172.31.39.36:4567
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.90ms    1.94ms  24.80ms   71.96%
    Req/Sec     6.47k     0.90k    9.42k    69.82%
  377215 requests in 30.00s, 46.77MB read
Requests/sec:  12572.42
Transfer/sec:      1.56MB

wrk -c 100 -d 60s http://172.31.39.36:4567

Running 1m test @ http://172.31.39.36:4567
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.70ms    1.87ms  23.01ms   74.27%
    Req/Sec     6.71k     1.13k   10.50k    65.79%
  775846 requests in 1.00m, 96.19MB read
Requests/sec:  12930.92
Transfer/sec:      1.60MB

wrk -c 200 -d 60s http://172.31.39.36:4567

Running 1m test @ http://172.31.39.36:4567
  2 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    18.23ms   15.87ms  66.16ms   83.70%
    Req/Sec     5.56k   709.99     7.07k    58.60%
  641419 requests in 1.00m, 79.52MB read
  Socket errors: connect 0, read 108620, write 0, timeout 0
Requests/sec:  10690.95
Transfer/sec:      1.33MB

wrk -c 300 -d 60s http://172.31.39.36:4567

Running 1m test @ http://172.31.39.36:4567
  2 threads and 300 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    27.37ms  159.86ms  13.17s    99.69%
    Req/Sec     8.11k     3.23k   13.16k    79.66%
  652228 requests in 1.00m, 80.86MB read
  Socket errors: connect 0, read 111143, write 0, timeout 1190
Requests/sec:  10869.85
Transfer/sec:      1.35MB

@gankkank
Copy link
Author

sinatra

wrk -c 100 -d 30s http://172.31.39.36:4567

Running 30s test @ http://172.31.39.36:4567
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    31.03ms    5.89ms  60.17ms   83.09%
    Req/Sec     1.61k   274.42     2.34k    68.62%
  96140 requests in 30.00s, 21.82MB read
Requests/sec:   3204.19
Transfer/sec:    744.72KB

wrk -c 100 -d 60s http://172.31.39.36:4567

Running 1m test @ http://172.31.39.36:4567
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    31.36ms    5.80ms  67.94ms   82.65%
    Req/Sec     1.60k   179.79     2.13k    78.89%
  190939 requests in 1.00m, 43.34MB read
Requests/sec:   3182.16
Transfer/sec:    739.60KB

wrk -c 200 -d 60s http://172.31.39.36:4567

Running 1m test @ http://172.31.39.36:4567
  2 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    64.26ms   27.11ms 195.20ms   73.08%
    Req/Sec     1.53k   130.41     1.90k    69.28%
  183477 requests in 1.00m, 41.64MB read
  Socket errors: connect 0, read 57743, write 0, timeout 32
Requests/sec:   3057.59
Transfer/sec:    710.65KB

wrk -c 300 -d 60s http://172.31.39.36:4567

Running 1m test @ http://172.31.39.36:4567
  2 threads and 300 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    90.82ms  133.00ms   6.57s    95.90%
    Req/Sec     1.88k   638.83     2.83k    70.32%
  182994 requests in 1.00m, 41.53MB read
  Socket errors: connect 0, read 58542, write 0, timeout 202
Requests/sec:   3049.38
Transfer/sec:    708.74KB

@gankkank
Copy link
Author

go bee (http://beego.me/quickstart)

wrk -c 100 -d 30s http://172.31.39.36:8080

Running 30s test @ http://172.31.39.36:8080
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   995.25ms  660.82ms   1.45s    68.38%
    Req/Sec     1.48k     2.56k   10.58k    81.44%
  91762 requests in 30.00s, 14.96MB read
Requests/sec:   3058.75
Transfer/sec:    510.79KB

wrk -c 300 -d 60s http://172.31.39.36:8080

Running 1m test @ http://172.31.39.36:8080
  2 threads and 300 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   865.13ms  792.31ms   1.69s    26.97%
    Req/Sec     1.50k     1.93k    8.66k    88.45%
  183025 requests in 1.00m, 29.85MB read
Requests/sec:   3049.92
Transfer/sec:    509.31KB

@gankkank
Copy link
Author

go net/http

wrk -c 100 -d 60s http://172.31.39.36:8080/hello

Running 1m test @ http://172.31.39.36:8080/hello
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.19ms    2.05ms  17.31ms   62.16%
    Req/Sec    12.42k     0.93k   17.93k    68.48%
  1431059 requests in 1.00m, 196.53MB read
Requests/sec:  23851.70
Transfer/sec:      3.28MB

wrk -c 200 -d 60s http://172.31.39.36:8080/hello

Running 1m test @ http://172.31.39.36:8080/hello
  2 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     8.50ms    3.38ms  31.90ms   64.57%
    Req/Sec    12.04k   787.66    16.33k    71.06%
  1412680 requests in 1.00m, 194.00MB read
Requests/sec:  23544.91
Transfer/sec:      3.23MB

wrk -c 300 -d 60s http://172.31.39.36:8080/hello

Running 1m test @ http://172.31.39.36:8080/hello
  2 threads and 300 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    12.75ms    3.64ms  35.49ms   65.38%
    Req/Sec    11.97k   630.63    15.68k    69.78%
  1412432 requests in 1.00m, 193.97MB read
Requests/sec:  23542.80
Transfer/sec:      3.23MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment