Skip to content

Instantly share code, notes, and snippets.

@sdogruyol
Created January 5, 2016 06:48
Show Gist options
  • Save sdogruyol/34ffe2f60acfeba9b095 to your computer and use it in GitHub Desktop.
Save sdogruyol/34ffe2f60acfeba9b095 to your computer and use it in GitHub Desktop.

Kemal vs Sinatra Benchmark

This is just for demonstration purpose. A simple app just returning "Hello World". First in Kemal (Crystal) and then in Sinatra(Ruby with thin).

Kemal (Crystal)

Kemal Version: 0.6.0 Crystal Version: 0.10.0

# app.cr
require "kemal"

get "/" do
  "Hello World!"
end

Sinatra (Ruby with Thin)

Sinatra Version: 1.4.6 Ruby Version: 2.2.2p95 Thin Version: 1.6.4

# app.rb
require "sinatra"

set :environment, :production
set :server, %w[thin]

get "/" do
  "Hello World!"
end

Running the benchmark

wrk is used to run this benchmark with 100 connections.

To run Kemal: crystal build --release src/app.cr && ./app To run Sinatra: ruby app.rb -p 3000

Finally to run benchmark:

wrk -c 100 -d 20 http://localhost:3000

@wieczorek1990
Copy link

You could write that kemal needs ssl development headers to build (libssl-dev).
Made some other benchmarks, put them in a docker. Gonna test rust frameworks someday.
https://github.com/wieczorek1990/benchmarks

@wieczorek1990
Copy link

Added rust: nickel and iron.

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