caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Joel Reymont <joelr1@gmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] ocamlnet, netclient and closing connection after every http client request
Date: Sun, 12 Jun 2011 12:56:57 +0200	[thread overview]
Message-ID: <1307876217.16462.14.camel@gps-desktop> (raw)
In-Reply-To: <12E34CD6-9D7D-4BA3-9576-57DC25AB94FC@gmail.com>

Am Samstag, den 11.06.2011, 18:11 +0400 schrieb Joel Reymont:
> I'm using netclient from ocamlnet 3.2.1 to issue thousands of http requests.
> 
> This leaves me with thousands of sockets hanging around open, until I run out of sockets.

This should not happen - the expected behavior is that the connection is
closed.

> Is there a way to tell netclient that I want a single connection open to my server at any given time, no more?

That should be controlled by number_of_parallel_connections.

> I tried copying Http_client.Convenience to add the following settings but this didn't solve my problem.
> 
> let http_realistic =
>   serialize
> 	  (fun () ->
> 	    let p = Lazy.force pipe in
> 	    let opt = p # get_options in
> 	    p # set_options
> 	      { opt with 
>           synchronization = Sync;
>           connection_timeout = 30.0; (* seconds *)
> 	        number_of_parallel_connections = 1;
>           inhibit_persistency = true;
>         };
> 	  )
> 
> What am I doing wrong?

No idea. Do you have a sample program demonstrating the effect?

Also, in ocamlnet-3.3.1 (released on Friday) large parts of the
Http_client were rewritten. Maybe your bug goes away by simply
upgrading.

Gerd


> 
> 	Thanks, Joel
> 
> --------------------------------------------------------------------------
> - for hire: mac osx device driver ninja, kernel extensions and usb drivers
> ---------------------+------------+---------------------------------------
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
> ---------------------+------------+---------------------------------------
> 
> 
> 
> 
> 



      reply	other threads:[~2011-06-12 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11 14:11 Joel Reymont
2011-06-12 10:56 ` Gerd Stolpmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307876217.16462.14.camel@gps-desktop \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).