Giter Club home page Giter Club logo

which_is_the_fastest's Introduction

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: 2018-01-18

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

Ranking (Framework)

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

Ranking (Language)

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

All frameworks

Language (Runtime) Framework (Middleware) Max [sec] Min [sec] Ave [sec]
ruby rails 169.990758 169.245815 169.500696
ruby sinatra 48.785529 48.654910 48.711666
ruby roda 18.727357 18.608974 18.661612
crystal kemal 4.178043 4.054511 4.129273
crystal router_cr 3.455170 3.376436 3.427589
crystal raze 3.562387 3.444175 3.536099
go echo 5.256643 4.904162 5.048713
go gorilla_mux 5.390430 4.980591 5.142020
go iris 5.244560 4.795147 4.989660
go fasthttprouter 3.715726 3.595522 3.662270
go gin 5.682742 5.357033 5.502924
rust iron 3.485740 3.357875 3.412701
rust nickel 3.485643 3.416737 3.464607
rust rocket 4.260527 4.139049 4.211128
node express 13.895781 13.413687 13.619828
node clusterexpress 9.048196 7.710249 8.209995
elixir plug 5.599585 5.259777 5.456209
elixir phoenix 5.693897 5.393461 5.618488
swift vapor 6.296311 5.985685 6.120673
swift perfect 6.570743 6.186247 6.362126
swift kitura 7.643707 7.318455 7.467837
scala akkahttp 9.675075 7.849877 8.536331
csharp aspnetcore 5.405356 4.861280 5.128910
python sanic 7.291824 6.076758 6.445577
python japronto 3.587456 3.509572 3.544309
nim jester 27.304759 27.177061 27.240023
objc criollo 28.879014 27.740031 28.389459

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 ruby

For each framework,

> neph rails

See neph.yaml

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 itself
  • benchmarker/benchmarker.cr <- Adding it as a target to
  • README.md <- Adding it as a target framework of the list
  • Makefile
  • neph.yaml (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

which_is_the_fastest's People

Contributors

adam12 avatar amscotti avatar audy avatar bernielxy avatar esemplastic avatar faustinoaq avatar ipomme avatar kelvinst avatar kiliankoe avatar kjessup avatar lucascaton avatar mattzink avatar mrkaspa avatar paulcsmith avatar petermm avatar petersonfs avatar philippgille avatar r6m avatar sdogruyol avatar sergiobenitez avatar steveklabnik avatar tanner0101 avatar tbrand avatar unreadable avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.