RejectedSoftware Forums

Sign up

take advantage of multiple cores

Hi,

I'd like to know how to setup the server so that it can fully utilize multiple cores, even with the simplest Helloworld application.

I tried to do a simple benchmark on Vibe.d yesterday with apache-ab, but when I hit the helloworld app with http load, it seems that only one cpu is occuppied and the results are not very impressive compared to nginx or even Java.

In nginx, you can set

worker_processes = 24

and then even the simplest helloworld app gets a big boost.

How do you do that in vibe.d? Do you have a benchmark comparison?

I once saw in a post that there is a config to let Fibers take up all cores, but forgot where it is.

Best Regards,

Puming.

Re: take advantage of multiple cores

On Mon, 27 Oct 2014 08:09:24 GMT, zhaopuming wrote:

Hi,

I'd like to know how to setup the server so that it can fully utilize multiple cores, even with the simplest Helloworld application.

I tried to do a simple benchmark on Vibe.d yesterday with apache-ab, but when I hit the helloworld app with http load, it seems that only one cpu is occuppied and the results are not very impressive compared to nginx or even Java.

In nginx, you can set

worker_processes = 24

and then even the simplest helloworld app gets a big boost.

How do you do that in vibe.d? Do you have a benchmark comparison?

I once saw in a post that there is a config to let Fibers take up all cores, but forgot where it is.

Best Regards,

Puming.

The setting is in HTTPServerSettings:

auto settings = new HTTPServerSettings;
settings.options |= HTTPServerOption.distribute;
listenHTTP(settings, ...);

It used to be the case that enableWorkerThreads() needed to be called, but that's not necessary anymore.

I currently can't guarantee that there isn't a performance regression, because I didn't perform a proper benchmark since a while. But to get the optimum performance, you also should put "versions": ["VibeManualMemoryManagement"] into dub.json, which avoids most uses of the GC for general HTTP request processing.

BTW, for benchmarking, I'd recommend to use "weighttp", which is more efficient than "ab", and to use separate machines for client and server, connected using at least gigabit ethernet. I got very different results when performing the tests using the loopback adapter.

Best regards,
Sönke

Re: take advantage of multiple cores

On Mon, 27 Oct 2014 21:23:00 GMT, Sönke Ludwig wrote:

On Mon, 27 Oct 2014 08:09:24 GMT, zhaopuming wrote:

Hi,

I'd like to know how to setup the server so that it can fully utilize multiple cores, even with the simplest Helloworld application.

I tried to do a simple benchmark on Vibe.d yesterday with apache-ab, but when I hit the helloworld app with http load, it seems that only one cpu is occuppied and the results are not very impressive compared to nginx or even Java.

In nginx, you can set

worker_processes = 24

and then even the simplest helloworld app gets a big boost.

How do you do that in vibe.d? Do you have a benchmark comparison?

I once saw in a post that there is a config to let Fibers take up all cores, but forgot where it is.

Best Regards,

Puming.

The setting is in HTTPServerSettings:

auto settings = new HTTPServerSettings;
settings.options |= HTTPServerOption.distribute;
listenHTTP(settings, ...);

It used to be the case that enableWorkerThreads() needed to be called, but that's not necessary anymore.

I currently can't guarantee that there isn't a performance regression, because I didn't perform a proper benchmark since a while. But to get the optimum performance, you also should put "versions": ["VibeManualMemoryManagement"] into dub.json, which avoids most uses of the GC for general HTTP request processing.

Thanks, I'll try them. I suggest these performance related stuff could be put in a 'benchmarking' or 'performance' related document.

BTW, for benchmarking, I'd recommend to use "weighttp", which is more efficient than "ab", and to use separate machines for client and server, connected using at least gigabit ethernet. I got very different results when performing the tests using the loopback adapter.

Interesting. I use ab in a different server (even with multiple servers). But definitely gonna try "weighttp"

Best regards,
Sönke

Re: take advantage of multiple cores

Hello !

Using vibd trunk !!

I did a test with zeon machine with 12 cores and got this rough results with an application:

  • without "settings.options |= HTTPServerOption.distribute" the vibed server only uses one core (7%) and serve around 17,000 requests/second.

-with "settings.options |= HTTPServerOption.distribute" the vibed server uses more cores (67%) and serve around 30,000 requests/second.

It seems that it doesn't scale proportional to the cpu usage, the application do not use any shared resource intentionally (vibed probably share some resources behind scenes).

I did a test with "versions": ["VibeManualMemoryManagement"] and the server crash with high load.

P.S.: This form textarea grows in height every time we type a character in firefox.

Cheers !