Re: [Nethttpd-plex] Poor performance on FreeBSD 8.2

Gerd Stolpmann <[email protected]> Mon, 11 Jul 2011 11:20:25 +0200
Newsgroups gmane.comp.lang.ocaml.lib.net.devel
Message-ID <1310376025.7945.4.camel@thinkpad>
Am Donnerstag, den 07.07.2011, 14:40 -0300 schrieb Matías Giovannini:
> I've migrated to Debian Lenny, and even though I see higher throughput
> compared to FreeBSD 8, there is a huge discrepancy between static file
> serving and dynamic services in Nethttpd:
> 
> 
> $ ./curl_test -v -m g -n 100
> 'http://127.0.0.1:4444/share/misc/magic.mime'
> Total time: 0.100 s (996.35 req/s)
> cURL  time: 0.100 s (1000.11 req/s)
> successes: 100/100
> $ ./curl_test -v -m g -n 100 'http://127.0.0.1:4444/adder'
> Total time: 3.961 s (25.25 req/s)
> cURL  time: 3.960 s (25.25 req/s)
> successes: 100/100
> 
> 
> I've measured my own dynamic handler and its activation is
> consistently under 1 ms, so I'm confident that it is not the handler
> code that is holding my throughput back.
> 
> 
> Maybe something to do with Netcgi? I'd love to hear your opinions.

So, under Linux I see something that is even more weird. For static
files I get a difference between native and bytecode, but other than
expected: there is a three times better performance for bytecode.

Experimentally, I set the TCP_NODELAY option in the server:

  let nethttpd_factory1 =
    Nethttpd_plex.nethttpd_factory
      ~handlers:[ "adder", adder ]
      () in
  let nethttpd_factory2 = 
    ( object
	method name = "nethttpd"
	method create_processor cc cf addr =
	  let p = nethttpd_factory1 # create_processor cc cf addr in
	  ( object
	      inherit Netplex_kit.processor_base
                         (p :> Netplex_types.processor_hooks)
	      method process ~when_done cont fd proto =
		Unix.setsockopt fd Unix.TCP_NODELAY true;
		p#process ~when_done cont fd proto
	      method supported_ptypes =
		p#supported_ptypes
	    end
	  )
      end
    ) 

This changed the game: adder is now even a bit faster, and I get around
1350 req/s on my Laptop.

Same under FreeBSD?

Gerd


> 
> 
> Regards,
> Matías.
> 
> On Tue, Jul 5, 2011 at 7:15 PM, Stéphane Legrand <[email protected]>
> wrote:
>         Le mardi 05 juillet 2011 à 17:30 -0300, Matías Giovannini a
>         écrit :
>         > Stéphane,
>         > it's odd, as testing the cURL script against a minimal
>         server I get
>         > good throughput:
>         >
>         >
>         > $ ./curl_test -v -n 1000 'http://127.0.0.1:9999/'
>         > Total time: 0.149 s (6699.49 req/s)
>         > cURL  time: 0.122 s (8206.21 req/s)
>         > successes: 1000/1000
>         >
>         
>         
>         I tried this server with the curl client. I also get much
>         higher request
>         rate (around 1000 req/sec).
>         
>         I really don't know. Have you tried to play with the curl
>         options,
>         particularly the TCP_NODELAY one ?
>         
>         
>         Regards,
>         Stéphane.
>         
>         
>         
>         
> 
> 
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security 
> threats, fraudulent activity, and more. Splunk takes this data and makes 
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________ Ocamlnet-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel

-- 
------------------------------------------------------------
Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany 
[email protected]          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Ocamlnet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel