From: Zoran V. <zv...@ar...> - 2006-01-12 08:03:35
|
Am 12.01.2006 um 05:19 schrieb Vlad Seryakov: > > 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. That is precisely what I had in mind and have written that in one of the recent emails. > 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. Kindof. > > 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? I believe Stephen had some remarks. They were originally ment for the spool thread but can be applied here. Quote: What happens to the conn thread after this? It can't wait for completion, that would defeat the purpose. Do traces (logging etc.) run now, in the conn thread, or later in a spool thread? If logging runs now, but the upload fails, the log will be wrong. If traces run in the spool threads they may block. I was also thinking that perhaps a spooler thread might be re-used for this, although I would have nothing against a specialized thread doing this sort of work. With this approach, even the Fastpath code could pass the socket to the "writer" thread making all even more scalable. The connection thread could only be used for generating dynamic content, whereas the writer thread could handle all static content serving. This makes very much sense to me. Zoran |