[Twisted-Python] Large file transfers

Tommi Virtanen tv at twistedmatrix.com
Mon Jul 29 05:35:31 EDT 2002


On Fri, Jul 26, 2002 at 07:41:27AM -0500, Chris Armstrong wrote:
> AFAIK, twisted.web.static _does_ do non-blocking reading, so check
> that out.  I don't think anyone has implemented non-blocking writing
> yet. (There's some sort of FileWrapper protocol or somesuch IIRC,
> but it just assumes that write() won't take very long -- it's only
> for testing)

	Bzzt, wrong. All file IO is sync. To do async file IO,
	you need to use a different kernel API -- called AIO,
	and not very widely available. (Or emulate it by forking
	worker processes that pass data between stdin/stdout and
	file).

	select(2)/poll(2) overhead has been historically deemed
	too high for async file IO, files tend to be so much faster
	that separating them from sockets was historically thought
	of as a good idea.

	Later generations have learned to curse select(2), see how
	slow network filesystems and cheap IDE disks can be, and hope
	for an low-overhead select(2)/poll(2) replacement for both
	file IO and non-file IO.

-- 
tv@{{hq.yok.utu,havoc,gaeshido}.fi,{debian,wanderer}.org,stonesoft.com}
double a,b=4,c;main(){for(;++a<2e6;c-=(b=-b)/a++);printf("%f\n",c);}




More information about the Twisted-Python mailing list