Skip to content

GlenTiki/which_is_the_fastest

 
 

Repository files navigation

Which is the fastest?

Measuring response times for each framework (middleware). Each framework has to have two features; routing and parsing path parameters.

Result

Last update: 2017-10-04

OS: Darwin (version: 17.0.0, arch: x86_64)
CPU Cores: 8

Ranking (Framework)

  1. router_cr (crystal)
  2. raze (crystal)
  3. japronto (python)
  4. fasthttprouter (go)
  5. iron (rust)
  6. nickel (rust)
  7. rocket (rust)
  8. kemal (crystal)
  9. echo (go)
  10. gorilla_mux (go)
  11. iris (go)
  12. aspnetcore (csharp)
  13. plug (elixir)
  14. phoenix (elixir)
  15. vapor (swift)
  16. perfect (swift)
  17. kitura (swift)
  18. sanic (python)
  19. akkahttp (scala)
  20. clusterexpress (node)
  21. express (node)
  22. roda (ruby)
  23. sinatra (ruby)
  24. rails (ruby)

Ranking (Language)

  1. crystal (router_cr)
  2. python (japronto)
  3. go (fasthttprouter)
  4. rust (iron)
  5. csharp (aspnetcore)
  6. elixir (plug)
  7. swift (vapor)
  8. scala (akkahttp)
  9. node (clusterexpress)
  10. ruby (roda)

All frameworks

Language (Runtime) Framework (Middleware) Max [sec] Min [sec] Ave [sec]
ruby rails 151.196547 150.960227 151.073975
ruby sinatra 43.854565 43.581662 43.664177
ruby roda 15.892388 15.811082 15.844165
crystal kemal 3.547369 3.075486 3.444593
crystal router_cr 2.486733 2.284032 2.344394
crystal raze 2.490715 2.399881 2.456708
go echo 3.785530 3.511024 3.647536
go gorilla_mux 3.970627 3.522344 3.686079
go iris 3.938069 3.583784 3.776195
go fasthttprouter 2.824961 2.686712 2.731345
rust iron 2.865915 2.743227 2.812815
rust nickel 2.877018 2.823066 2.858988
rust rocket 3.276701 3.145324 3.204920
node express 13.961471 13.668522 13.791606
node clusterexpress 8.187491 7.431857 7.656550
elixir plug 4.895296 4.368241 4.727784
elixir phoenix 5.307217 4.877070 5.116376
swift vapor 5.613291 5.250472 5.479300
swift perfect 5.703425 5.575321 5.648020
swift kitura 6.678699 6.379810 6.503248
scala akkahttp 8.330310 7.047381 7.584030
csharp aspnetcore 3.959679 3.799744 3.860993
python sanic 7.359875 6.208559 6.735841
python japronto 2.639756 2.590362 2.610999

Current target frameworks (middlewares)

See Development section when you want to add new languages or frameworks.

The rule

We want to know the response time, not a usability. So full-stack framework is at a disadvantage.

  • Each server has no special logics.
  • Each server's executable is named as server_[Lauguage]_[Framework]. (For example, server_ruby_sinatra)
  • There are only 3 routes
    • GET '/' return status code 200 with empty body
    • GET '/user/:id' return status code 200 with the id
    • POST '/user' return status code 200 with empty body

Installation

Required environment -> See Current target frameworks(middlewares)

By using Neph

Neph is a modern command line job processor that can be substitute for make command.

To compile servers and benchmarker,

> neph

For each language,

> neph -j ruby

For each framework,

> neph -j rails

See neph.yml

By using make

To compile servers and benchmarker,

> make

For each language,

> make ruby

For each framework,

> make rails

Usage

You can take a benchmark by

> bin/benchmarker

For each language

> bin/benchmarker ruby

For each framework

> bin/benchmarker rails

For comparison (Comparing rails, kemal and router.cr in this example)

> bin/benchmarker rails crystal

If you take it manually, you can run each server by

> bin/server_[Language]_[Framework]

and run client by

> time bin/client

You can set # of threads and # of the loops of the request(there are 3 requests in a loop) by

> time bin/client -t 16 -r 1000

In the above example, 16 threads requests 1000 * 3 times. So 48000 requests are sent in total.

Using Docker

Setup servers by using docker is under WIP. Currently, crystal and ruby servers are supported. For example

docker-compose up rails

Then you can run your client by

time ./bin/client

Development

  • Give me PR when you want to add other web frameworks
  • Give me PR when you can tuning each framework (under the rule)

Where should I modify when adding new framework

  • /[language]/[framework]/[codes] <- Project iteself
  • benchmarker/benchmarker.cr <- Adding it as a target to
  • README.md <- Adding it as a target framework of the list
  • Makefile
  • neph.yml (optional)

Anyway, you don't have to care about details since maintainer can fix them after merging it. The result will be updated by maintainer.

Contributing

  1. Fork it (https://github.com/tbrand/which_is_the_fastest/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Donate

1AE9P6TUVik1rJGQhaSqGWRk1oAQ3DJnmo

QRCode

About

Which is the fastest web framework?

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • XSLT 26.8%
  • Elixir 24.0%
  • Ruby 23.8%
  • CSS 5.6%
  • Makefile 5.6%
  • Swift 2.7%
  • Other 11.5%