In a message dated 11/19/2003 12:01:20 AM Eastern Standard Time, [EMAIL PROTECTED] writes:
Date: Tue, 18 Nov 2003 07:45:26 -0800
From: Jim Wilcoxson <[EMAIL PROTECTED]>
Subject: Re: Jim's Sunday commits and AOLserver 4.1
> In a message dated 11/18/2003 12:03:27 AM Eastern Standard Time,
> [EMAIL PROTECTED] writes:
> Subject: Re: Jim's Sunday commits and AOLserver 4.1
>
> On 2003.11.17, Jim Davidson <[EMAIL PROTECTED]> wrote:
> > Glad somebody noticed the new code :) The changes to kick of 4.1 were in
> two
> > areas:
> >
> > 1. Adding an I/O event callback interface for connections before they
> > are queued for processing (called "pre-queue"). The interface is a
> > bit tricky to use and there's no documentation or example module
> > (yet). The general idea is to enable efficient pre-fetch of remote
> > resources prior to running the connection, keeping the connection
> > threads from stalling on I/O. For the ordinary nssock module, there
> > should be no impact. For the SSL module, reads are now handled by
> > special reader threads, not the connection threads. This may require
> > moving some state from thread to connection and/or socket local
> > storage.
For requests that include file uploads, does a single, event-driven
thread read in the entire request now, including the file data, before
starting a connection thread?
Yes -- the event-driven I/O thread accepts and reads the entire request before queueing for processing. Note this is how it has worked in 4.0 since the first 4.0 beta release. In fact, the 4.0 conn read API's now emulate previous 3.x by simply copying from the read-ahead buffers. Compare 4.0 Ns_ConnRead which simply copys data without blocking:
int
Ns_ConnRead(Ns_Conn *conn, void *vbuf, int toread)
{
Conn *connPtr = (Conn *) conn;
Request *reqPtr = connPtr->reqPtr;
Ns_ConnRead(Ns_Conn *conn, void *vbuf, int toread)
{
Conn *connPtr = (Conn *) conn;
Request *reqPtr = connPtr->reqPtr;
if (connPtr->sockPtr == NULL) {
return -1;
}
if (toread > reqPtr->avail) {
toread = reqPtr->avail;
}
memcpy(vbuf, reqPtr->next, (size_t)toread);
reqPtr->next += toread;
reqPtr->avail -= toread;
return toread;
}
return -1;
}
if (toread > reqPtr->avail) {
toread = reqPtr->avail;
}
memcpy(vbuf, reqPtr->next, (size_t)toread);
reqPtr->next += toread;
reqPtr->avail -= toread;
return toread;
}
with the old 3.x code which actually calls the comm driver to read from the client browser, possibly blocking waiting for input:
int
Ns_ConnRead(Ns_Conn *conn, void *vbuf, int toread)
{
Conn *connPtr = (Conn *) conn;
int nread;
if (CONN_CLOSED(connPtr)) {
nread = -1;
} else {
nread = (*connPtr->drvPtr->readProc)(connPtr->drvData, vbuf, toread);
if (nread > 0 && connPtr->readState == Content) {
connPtr->nContent += nread;
}
}
return nread;
}
nread = -1;
} else {
nread = (*connPtr->drvPtr->readProc)(connPtr->drvData, vbuf, toread);
if (nread > 0 && connPtr->readState == Content) {
connPtr->nContent += nread;
}
}
return nread;
}
This is a key and important difference between the 3.x and 4.x I/O models.
-Jim
-- AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.