caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocamlnet, netclient and closing connection after every http client request
@ 2011-06-11 14:11 Joel Reymont
  2011-06-12 10:56 ` Gerd Stolpmann
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Reymont @ 2011-06-11 14:11 UTC (permalink / raw)
  To: caml-list

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.

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

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?

	Thanks, Joel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] ocamlnet, netclient and closing connection after every http client request
  2011-06-11 14:11 [Caml-list] ocamlnet, netclient and closing connection after every http client request Joel Reymont
@ 2011-06-12 10:56 ` Gerd Stolpmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Stolpmann @ 2011-06-12 10:56 UTC (permalink / raw)
  To: Joel Reymont; +Cc: caml-list

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
> ---------------------+------------+---------------------------------------
> 
> 
> 
> 
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-12 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-11 14:11 [Caml-list] ocamlnet, netclient and closing connection after every http client request Joel Reymont
2011-06-12 10:56 ` Gerd Stolpmann

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).