Simple web server benchmark - vibe.d is slower than node.js and Go?

Daniel Kozak kozzi11 at gmail.com
Thu Sep 21 13:01:43 UTC 2017


my version: https://paste.ofcode.org/RLX7GM6SHh3DjBBHd7wshj

On Thu, Sep 21, 2017 at 2:50 PM, Sönke Ludwig via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> Am 21.09.2017 um 14:41 schrieb Vadim Lopatin:
>
>> On Thursday, 21 September 2017 at 10:21:17 UTC, Sönke Ludwig wrote:
>>
>>>      shared static this()
>>>>      {
>>>>          (...)
>>>>      }
>>>>
>>>
>>> BTW, I'd recommend using
>>>
>>>     void main()
>>>     {
>>>         (...)
>>>         runApplication();
>>>     }
>>>
>>> instead and dropping the VibeDefaultMain version in the package recipe.
>>> The old approach is planned to be faded out slowly, because it requires
>>> some special DUB support that would be nice to see gone at some point.
>>>
>>
>> Thank you!
>> Trying to use multithreaded mode.
>>
>> Under windows, best Vibe.d results are equal to results of Go server.
>> Under linux, Vibe.d is still slower even if there are 4 threads listening.
>>
>> Results:
>>
>> OS       lang:config   req/s    comments
>> =======  ==========    =======  ==========
>> Linux    go            53K
>> Linux    D:default     48K      1 thread
>> Linux    D:libevent    48K      1 thread
>> Linux    D:libasync    46.5K    4 threads
>>
>> Windows  go            12K
>> Windows  D:default     12K      4 threads
>> Windows  D:libevent    12K      4 threads
>> Windows  D:libasync    7K       4 threads
>>
>> Under Linux in default and libevent configurations, I see error messages
>> from 3 of 4 threads - looks like only one thread can process connections.
>>
>> Failed to listen on 0.0.0.0:3000
>> Task terminated with uncaught exception: Failed to listen for incoming
>> HTTP connections on any of the supplied interfaces.
>>
>>
>>
> Oh, sorry, I forgot the reusePort option, so that multiple sockets can
> listen on the same port:
>
>     auto settings = new HTTPServerSettings("0.0.0.0:3000");
>     settings.options |= HTTPServerOption.reusePort;
>     listenHTTP(settings, &handleRequest);
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20170921/7da29961/attachment.html>


More information about the Digitalmars-d mailing list