[Web-SIG] yield considered harmful (was: x-wsgiorg.flush)
Phillip J. Eby
pje at telecommunity.com
Sat Oct 6 08:03:02 CEST 2007
At 01:07 PM 10/6/2007 +1000, René Dudfield wrote:
>I think 'streaming' is good for speeding up web pages when processing
>takes a while.
>
>I'll explain why...
>
>Say your page takes 0.2 seconds to process.
>
>If you wait until 0.2 seconds is up, then the first bytes that will
>come to the browser will arrive in at least 0.2 seconds. Whereas if
>you send data as soon as its ready, then the user will be able to see
>some of that data more quickly - and possibly make more requests
>sooner.
It's faster for the user, but not necessarily for the server. The
server will do more system calls, and the CPU will do more context
switches. So, if you're going to stream for purposes of
responsiveness, you're going to be trading off against overall server
throughput.
Nonetheless, the pages where you even have the choice of streaming
are infrequent. Most of the examples I see of people doing streaming
are completely worthless, because there isn't any non-trivial
computation taking place between the yields.
More information about the Web-SIG
mailing list