nim-chronos icon indicating copy to clipboard operation
nim-chronos copied to clipboard

Implement some basic benchmarks

Open zah opened this issue 6 years ago • 6 comments

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.

zah avatar Jun 27 '18 23:06 zah

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.

  • The recommended URI is /plaintext.
  • The response content type must be set to text/plain.
  • The response body must be Hello, World!.
  • The response headers must include (Content-Length or Transfer-Encoding) and Server and Date.

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!

2vg avatar Jun 28 '18 22:06 2vg

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

nitely avatar Jun 29 '18 13:06 nitely

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...

2vg avatar Jun 29 '18 14:06 2vg

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...

kdeme avatar Aug 23 '18 09:08 kdeme

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

jangko avatar Aug 23 '18 10:08 jangko

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

  • Estimated time of work to be done
  • Required Experience level: (beg, interm, expert)
  • amount to be posted: (1000 - 2000) DAI
    • if this range is inappropriate, we can move it to a new label
  • accepted work criterion

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

StatusSceptre avatar Apr 17 '19 14:04 StatusSceptre