[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: Concurrent connections



Interesting, thank you Howard.  Does the main thread just iterate over the sockets looking for ones with available bytes to be read and then hand those off rather than blocking on a read on a particular socket?  All of the socket coding I've done in the past, even with thread pools, has been very simple and just allocated a thread to a socket for the lifetime of the session so this is an interesting model.  Clearly the simple model I've used was for simpler applications where persistent connections weren't used and it would be ill-suited to a persisten connection environment.

Always nice to learn something new while figuring out my configuration:)

Thanks again!

Jamey


-----Original Message-----
From: Howard Chu [mailto:hyc@symas.com]
Sent: Tuesday, November 18, 2003 7:34 PM
To: James Courtney; 'Open LDAP Software (E-mail)'
Subject: RE: Concurrent connections


> -----Original Message-----
> From: James Courtney [mailto:Jcourtney@inphonic.com]

> Thanks Howard.
> 	After further thought, I realized I didn't fully 
> understand how it works.
> How is the threads setting used then?  Once a new socket is 
> established the main server thread must hand off management 
> of the endpoint of that connection to another thread right?

Yes.
  
> For a thread to use a socket for multiple requests it must 
> remain bound to that socket and thus wouldn't the size of the 
> thread pool dictate how many persistent socket connections 
> could be openend simultaneously to the LDAP server?

No. Threads are not bound to sockets. A single incoming request on any connection is handed off to any available thread. The size of the thread pool dictates the number of operations that can execute simultaneously. The main server thread performs all of the handoffs.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support