Vlad Seryakov wrote:
Hi,
I have another idea for you to check:
Will it be usefull to have special writer thread that will send
multiple files in async mode to multiple clients. For example if i
serve big ISO or movie files and have many connections, currently they
all use conn thread for along time until the whole file is sent.
Instead we can mark the conn to be used in writer thread and release
conn thread for other requests and in the meantime the writer thread
will send multiple FDs to clients in one big loop.
this is exactly what we are doing in our production system, and what the
code posted in
http://sourceforge.net/mailarchive/message.php?msg_id=14351395
does. With the recent change in naviserver, that zoran put in, this code
runs without a patch in
naviserver (provided you have the tclthread library and the
xotcl-support from aocs/packages/xotcl-core
installed).
the recent discussion was however, to generalize this further and use
such thread for
sending and receiving, thus the proposed name "spooling-thread".
-gustaf
Currently it is possible to simply change ConnSend in connio.c to
submit open descriptor to the writer queue and return marking the
connection so usual NsClose will not close actual connection socket.
Then write thread will be simple loop reading small chunks from every
file and sending to corresponding socket.
Does it make sense?