Simple web server benchmark - vibe.d is slower than node.js and Go?
Daniel Kozak
kozzi11 at gmail.com
Fri May 11 07:56:04 UTC 2018
On Wednesday, 9 May 2018 at 22:37:22 UTC, Arun Chandrasekaran
wrote:
>>> That could be the reason for slowness.
>
> Ubuntu 17.10 64 bit, DMD v2.079.1, E7-4860, 8 core 32 GB RAM.
>
> With slight modifcaition to capture the timestamp of the
> request on the server:
>
> import std.datetime.systime : Clock;
> auto tm = Clock.currTime().toISOExtString();
> writeln(tm, " My Thread Id: ", to!string(thisThreadID));
> // simulate long runnig task
> Thread.sleep(dur!("seconds")(3));
>
> if (req.path == "/")
> res.writeBody(tm ~ " Hello, World! from " ~
> to!string(thisThreadID), "text/plain");
>
>
> Launch two parallel curls.. and here is the server log..
>
> Master 13284 is running
> [vibe-6(5fQI) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-7(xljY) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-2(FVCk) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-3(peZP) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-8(c5pQ) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-4(T/oM) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-5(zc5i) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-1(Rdux) INF] Listening for requests on
> http://0.0.0.0:8080/
> [vibe-0(PNMK) INF] Listening for requests on
> http://0.0.0.0:8080/
> 2018-05-09T15:32:41.5424275 My Thread Id: 140129463940864
> 2018-05-09T15:32:44.5450092 My Thread Id: 140129463940864
> 2018-05-09T15:32:56.3998322 My Thread Id: 140129463940864
> 2018-05-09T15:32:59.4022579 My Thread Id: 140129463940864
> 2018-05-09T15:33:12.4973215 My Thread Id: 140129463940864
> 2018-05-09T15:33:15.4996923 My Thread Id: 140129463940864
>
>
> PS: Your top posting makes reading your replies difficult
I have change my example a little:
case "/": res.writeBody("Hello World " ~ to!string(thisThreadID),
"text/plain");
And I get this (siege -p -c15 0b -t 10s http://127.0.0.1:3000 |
grep World | sort | uniq):
Hello World 140064214951680
Hello World 140064223344384
Hello World 140064231737088
Hello World 140064240129792
Hello World 140064248522496
Hello World 140064256915200
Si I get six different thread ids, which is OK because I have 6
cores
More information about the Digitalmars-d
mailing list