Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Ocamlnet-devel] Nethttpd_plex performance question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-13 (15:29)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Ocamlnet-devel] Nethttpd_plex performance question
Hi Andre,

the results are more or less what I would expect. For cached static pages
there is no advantage of using multiple processes. Nethttpd has the built-in
capability of handling serveral connecrtions in parallel, so easy_daemon
already profits from that. As the static pages need not to be loaded
from anywhere, and there are no other complex computations either,
easy_daemon runs under optimal conditions.

Using multiple processes implies a lot of additional overhead. I don´t
mean the time for creating processes (which is hidden from the user
in the prefork model), but there is some extra communication for
coordinating the processes.

Generally, the multi-process model has advantages only if either

- there is some wait time until the web page is available, such as
  loading it from disk or requesting it from some background
- you need some CPU time to compute the pages, and you have
  several CPU´s
- you need some CPU time, and you want to minimize latencies
  (even on a 1-CPU box)
- your program is a bit instable - crashing a sinegle
  process does not stop the whole service

As you have figured out, measuring performance is more difficult
for a multi-process server. This has mostly to do with the varying
startup time until all processes are created. The longer the benchmark
the better, and you will see stabler numbers. 600 qps roughly matches
what I measured a few months ago.

I hope this helps,


Andre Nathan said:
> Hello
> I'm trying to write a simple webserver using Nethttpd_plex from the
> ocamlnet package. I did a simple benchmark using the examples provided
> in the distribution ( and Both examples
> create static pages, but the netplex version shows worse performance,
> which I think is odd because it uses a multi-process model, while
> easy_damon is a single process handling all requests.
> I'm running "ab" (apache's benchmark tool), doing 1,000 connections, 100
> concurrently. Here are the results:
> - easy_daemon:
> Requests per second:    1699.87 [#/sec] (mean)
> - netplex:
> Requests per second:    591.22 [#/sec] (mean)
> [netplex's results actually vary a lot, sometimes reaching about 1,000
> req/s but sometimes also being as low as 300 req/s. On average it seems
> to be around 600 req/s]
> I'm using the following configuration for netplex's workload_manager:
>     workload_manager {
>       type = "dynamic";
>       max_jobs_per_thread = 1;
>       min_free_jobs_capacity = 30;
>       max_free_jobs_capacity = 50;
>       max_threads = 256;
>     };
> Does anyone have any tips for improving netplex's performance? I believe
> that with the right settings it should be able to outperform the simpler
> daemon easily, since it's using multiple processes.
> I hope this question is appropriate for the list.
> Thanks in advance,
> Andre
> -------------------------------------------------------------------------
> This email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> _______________________________________________
> Ocamlnet-devel mailing list

Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany