You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@mch.sni.de> on 1999/08/13 09:05:02 UTC

Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c

>   Add a connection ID to conn_rec. It uniquely identifies a connection at
>   any instant in time. It's not very well tested yet.

...
>   +    long conn_id = child_num * HARD_THREAD_LIMIT + thread_num;

Won't this make Asynch I/O difficult? The intention of AsIO worker threads
was to make it possible to pass work on one connection to a different
thread (for completion). But in the mean time (while the worker thread
continued work on the original connection), the original thread could
accept a new connection (__and get the same conn_id__).

Just a thought.
    Martin
-- 
<Ma...@MchP.Siemens.De>      |        Siemens Information and
Phone: +49-89-636-46021               |        Communication  Products
FAX:   +49-89-636-47816               |        81730  Munich,  Germany

Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c

Posted by Manoj Kasichainula <ma...@io.com>.
On Fri, Aug 13, 1999 at 09:05:02AM +0200, Martin Kraemer wrote:
> >   +    long conn_id = child_num * HARD_THREAD_LIMIT + thread_num;
> 
> Won't this make Asynch I/O difficult?

That line is in dexter, which doesn't do async I/O right now. An async
I/O server can use a different method to choose a connection ID.

-- 
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/
"Only reason I can't survive is if I'm dead or something" -- Mike Tyson

Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt

Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
Sorry, I mis-read your idea.  That should work.  :)
Ryan


On Mon, 16 Aug 1999, Manoj Kasichainula wrote:

> On Fri, Aug 13, 1999 at 06:14:39PM -0400, Ryan Bloom wrote:
> > > conn_id = child_num * (maximum fds/process) + fd of connection.
> > 
> > The problem with what you suggested above, is what happens when the fd is
> > something like 549?  It will spill over into another proesses #'s.
> 
> can a file descriptor ever have a value >= (max fds/process)? If not
> then this scheme shouldn't be a problem, right?
> 
> -- 
> Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/
> 

_______________________________________________________________________
Ryan Bloom		rbb@raleigh.ibm.com
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	


Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c

Posted by Manoj Kasichainula <ma...@io.com>.
On Fri, Aug 13, 1999 at 06:14:39PM -0400, Ryan Bloom wrote:
> > conn_id = child_num * (maximum fds/process) + fd of connection.
> 
> The problem with what you suggested above, is what happens when the fd is
> something like 549?  It will spill over into another proesses #'s.

can a file descriptor ever have a value >= (max fds/process)? If not
then this scheme shouldn't be a problem, right?

-- 
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/

Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c

Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
> There is no code yet, so it's okay that you didn't look at it.

I thought Dean had been hacking some up a while ago.  I guess I mis-read
a message at some point.  :)

> > conn_id = child_num + next_conn_id_num.
> 
> conn_id = child_num * (maximum fds/process) + fd of connection.

Oops, typed it in to fast, what I meant was:

conn_id = child_num * 100 + next_conn_id_num.

No need to go through those hoops.  Since AFAIK, there will only be one
thread accepting connections, it can keep a count of connections, kind of
like the OS keeps the pid.  When a new request comes in, the accepting
thread just adds the next number in line to his child_num *100.  The * 100
keeps the numbers unique.

The problem with what you suggested above, is what happens when the fd is
something like 549?  It will spill over into another proesses #'s.

OK, reviewed this again, neither one of the above will garauntee
uniqueness, although mine will if the number of threads is ALWAYS < 100.
The algorithm I would choose would be:

conn_id = child_num * MAX_THREADS_PER_CHILD + count_num;
if (++count_num >= MAX_THREADS_PER_CHILD)
    count_num = 0;

There are problems with this when MAX_THREADS_PER_CHILD is too low.  But
it is a quick approx of what it should be.

Ryan

_______________________________________________________________________
Ryan Bloom		rbb@raleigh.ibm.com
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	



Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c

Posted by Manoj Kasichainula <ma...@io.com>.
On Fri, Aug 13, 1999 at 07:11:20AM -0400, Ryan Bloom wrote:
> I don't see why this algorithm should be used for the AsIO mpm.  HAving
> never looked at that code,

There is no code yet, so it's okay that you didn't look at it.

> it would make more sense to me, to have the
> AsIO mpm use
> 
> conn_id = child_num + next_conn_id_num.
> 
> Where, the conn_id num, is kept track of my the accepting socket.

I'm not sure if you mean the same thing as I'm about to say, but I was
thinking:

conn_id = child_num * (maximum fds/process) + fd of connection.

-- 
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/
"Show me an Ethernet collision and I'll show you a network that could
do with one user fewer." -- BOFH

Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c

Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
I don't see why this algorithm should be used for the AsIO mpm.  HAving
never looked at that code, it would make more sense to me, to have the
AsIO mpm use

conn_id = child_num + next_conn_id_num.

Where, the conn_id num, is kept track of my the accepting socket.  Of
course, this all relies on my understanding of the AsIO mpm, which is
shaky at best.  I really do have to devote some time to re-learning Apache
at some point.  :-)  I've been stuck in APR too long.

Ryan

On Fri, 13 Aug 1999, Martin Kraemer wrote:

> >   Add a connection ID to conn_rec. It uniquely identifies a connection at
> >   any instant in time. It's not very well tested yet.
> 
> ...
> >   +    long conn_id = child_num * HARD_THREAD_LIMIT + thread_num;
> 
> Won't this make Asynch I/O difficult? The intention of AsIO worker threads
> was to make it possible to pass work on one connection to a different
> thread (for completion). But in the mean time (while the worker thread
> continued work on the original connection), the original thread could
> accept a new connection (__and get the same conn_id__).
> 
> Just a thought.
>     Martin
> -- 
> <Ma...@MchP.Siemens.De>      |        Siemens Information and
> Phone: +49-89-636-46021               |        Communication  Products
> FAX:   +49-89-636-47816               |        81730  Munich,  Germany
> 

_______________________________________________________________________
Ryan Bloom		rbb@raleigh.ibm.com
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.