status-im / nim-chronos

Chronos - An efficient library for asynchronous programming
https://status-im.github.io/nim-chronos/docs/chronos
Apache License 2.0
356 stars 52 forks source link

Implement some basic benchmarks #5

Open zah opened 6 years ago

zah commented 6 years ago

Your goal will be to create a benchmark testing asyncdispatch2 against the Nim's existing asyncdispatch module and the best competing frameworks available in other programming languages. A suitable choice would be implementing one of the TechEmperor famous benchmarks:

https://www.techempower.com/benchmarks/#section=data-r15&hw=ph&test=plaintext

In particular, the plaintext case was selected because it makes use of HTTP pipelining which pushes all the frameworks to their limit.

The expected delivery is working code for the test case with the new and the old asyncdispatch modules as well a set of helper scripts allowing us to re-run the tests later and compare the results against some of the best performing frameworks available for other languages.

2vg commented 6 years ago

cool :) I am looking forward to the benchmark.

Let's decide the rules of the benchmark. Imitating TechEmpower's rules would result in the following.

and, I saw the pull request of plaintext benchmark. If other web frameworks also participate in the benchmark, it will be fair to include the parsing of the header etc.

Example request

GET /plaintext HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Linux x86_64) Gecko/20130501 Firefox/30.0 AppleWebKit/600.00 Chrome/30.0.0000.0 Trident/10.0 Safari/600.00
Cookie: uid=12345678901234567890; __utma=1.1234567890.1234567890.1234567890.1234567890.12; wd=2560x1600
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Connection: keep-alive

Example response

HTTP/1.1 200 OK
Content-Length: 13
Content-Type: text/plain; charset=UTF-8
Server: Example
Date: Wed, 17 Apr 2013 12:00:00 GMT

Hello, World!
nitely commented 6 years ago

I won't be working on PR #4 anymore. So, someone else can take over it. Everything in TechEmpower is open source. They use wrk for the client [0] + a lua script to enable pipelining. The code for running each server/framework is there as well.

If other web frameworks also participate in the benchmark, it will be fair to include the parsing of the header etc.

Most of them just parse the Request-Line and the headers are parsed lazily (i.e: when accessing the headers for the first time, so they are not parsed in the benchmarks). Some of them will cache the response. So, there shouldn't be much of a difference from current benchmarks.

[0] https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/toolset/wrk

2vg commented 6 years ago

Oh, that is sad, but if I have time I also want to help benchmark setup.

Most of them just parse the Request-Line and the headers are parsed lazily that's true...

kdeme commented 6 years ago

I could give a go at this, but I would need some updated information on the current state and what is actually wanted.

I've ran then code from nitely and on the latest revision it does not work anymore (see discussion at https://github.com/status-im/nim-asyncdispatch2/pull/4) , however the code on the gist of cheatfate does work.

Next to that, what is actually wanted now? These basics tests, or to run them with the TechEmpower framework, or something else? And should this also be set up somewhere to keep running as part of CI?

Let me know...

jangko commented 6 years ago

Current state: I am working on this #9, perhaps tomorrow I will push a working prototype

StatusSceptre commented 5 years ago

In order to be approved as an bounty-xl I will need the following:

approval from at least 2 core contributors to give this out as a bounty via a "thumbs up" on the requirements comment.