Git Product home page Git Product 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-10

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

Ranking (Framework)

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

Ranking (Language)

  1. crystal (router_cr)
  2. rust (nickel)
  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. objc (criollo)

All frameworks

Language (Runtime) Framework (Middleware) Max [sec] Min [sec] Ave [sec]
ruby rails 161.079991 160.341164 160.664641
ruby sinatra 45.534552 45.326070 45.378119
ruby roda 16.244110 16.204136 16.220350
crystal kemal 3.292682 3.157299 3.252980
crystal router_cr 2.552623 2.471256 2.516766
crystal raze 2.777100 2.665155 2.735574
go echo 4.159959 4.011258 4.077308
go gorilla_mux 4.170352 3.909323 4.036364
go iris 4.348133 3.864387 4.073871
go fasthttprouter 3.016682 2.886777 2.962532
rust iron 3.023135 2.837906 2.918141
rust nickel 2.818330 2.780301 2.803500
rust rocket 3.556692 3.363295 3.426910
node express 12.429907 11.482538 11.783619
node clusterexpress 7.884909 6.594599 6.911125
elixir plug 4.654937 4.269527 4.546351
elixir phoenix 4.933707 4.788846 4.854297
swift vapor 5.561565 5.325290 5.412418
swift perfect 5.634706 5.352592 5.545727
swift kitura 6.652122 6.514098 6.582017
scala akkahttp 9.114887 7.183424 7.819570
csharp aspnetcore 4.099906 3.747440 3.849951
python sanic 6.438378 5.505323 5.748179
python japronto 2.857492 2.797253 2.827124
objc criollo 34.878167 23.799794 26.548463

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

which_is_the_fastest's People

Contributors

adam12 avatar audy avatar bernielxy avatar esemplastic avatar faustinoaq avatar ipomme avatar kelvinst avatar kiliankoe avatar kjessup avatar lucascaton avatar mattzink avatar mrkaspa avatar petermm avatar petersonfs avatar philippgille avatar r6m avatar sergiobenitez avatar steveklabnik avatar tanner0101 avatar tbrand avatar thecatalinstan 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.