On 1/3/06, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
> I am attaching the whole driver.c file because patch would not be very
> readable.
>
> See if this a good solution or not, it works and uses separate thread
> for all reading and spooling, also all upload stats are done in the
> spoller thread, so driver thread now works without any locking.
>
> ...
>


I find it confusing that the actual spooling code is not in the
SpoolThread, but still in SockRead().

Take a look at nsd/task.c.  I think you should be able to implement
this as a Ns_Task callback, which gives you the extra thread and all
the poll handling etc. for free.  Move the spooling code from SockRead
into the task callback.

Later, we could add another task queue for large downloads.

Can you split out the upload stats code.  One functional change at a
time is much easier to follow.


I think the basic approach you've got here is the right first step. 
Single thread, blocking disk writes, triggered from driver thread so
no bouncing between the conn thread.  The basic programming model
remains the same.

Once the upload code is working we can add the upload stats and
pre-queue filters for quota checking etc.  After that we can
investigate AIO for disk access to make everything more efficient.

Reply via email to