Skip to content

mattzink/which_is_the_fastest

 
 

Repository files navigation

Which is the fastest?

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

Result

Last update: 2017-11-03

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

Ranking (Framework)

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

Ranking (Language)

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

All frameworks

Language (Runtime) Framework (Middleware) Max [sec] Min [sec] Avg [sec]
ruby rails 158.707613 157.559875 157.970116
ruby sinatra 44.278810 44.183649 44.252526
ruby roda 16.180626 16.132779 16.151732
crystal kemal 3.233941 3.054319 3.190098
crystal router_cr 2.432883 2.280620 2.318383
crystal raze 2.508283 2.407160 2.476729
go echo 3.798276 3.490771 3.592064
go gorilla_mux 3.897310 3.561739 3.726176
go iris 4.016436 3.507674 3.825695
go fasthttprouter 2.807106 2.716368 2.751400
rust iron 2.962235 2.717031 2.835935
rust nickel 2.856162 2.783444 2.834548
rust rocket 3.223768 3.153677 3.187345
node express 13.988441 13.727441 13.807823
node clusterexpress 8.088965 7.502522 7.720822
elixir plug 4.659650 4.258834 4.477080
elixir phoenix 4.999001 4.768156 4.844404
swift vapor 5.538846 5.314528 5.418623
swift perfect 5.833395 5.570222 5.668958
swift kitura 6.655281 6.476810 6.548700
scala akkahttp 8.692796 7.160795 7.619564
csharp aspnetcore 3.978898 3.616286 3.807356
python sanic 6.497731 5.388541 5.736287
python japronto 2.684628 2.553546 2.621803
objc criollo 34.808480 24.054073 27.575090

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 (routing 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

  • Objective-C 89.1%
  • XSLT 2.6%
  • Elixir 2.3%
  • Ruby 2.3%
  • Shell 1.3%
  • Makefile 0.6%
  • Other 1.8%