From: Kragen S. <kra...@ai...> - 2004-01-14 17:31:08
|
On Tue, Jan 13, 2004 at 07:15:11PM -0800, Adam Rifkin wrote: > Just wrote: > > Mod_pubsub: yes (in fact the author of mod_pubsub credited Pushlets as > > the inventor of HTTP/JavaScript streaming!). I played with their demos > > and captured the HTTP conversation (with tcpflow) but the mechanism > > appears the same as the Pushlet (very much the same in the sense that > > mod_pubsub has almost identical JS callbacks like parent.push()!). Their > > protocol is more elaborate. As far as I can see mod_pubsub would have to > > deal with permanent HTTP connections as well. On the other hand Apache > > itself is very scalable. > > A key difference is that in mod_pubsub, a single push connection can > be shared by several open browser windows in the same browser process. We didn't want to do this, but we had to do it in order to work around browser limitations. > On the scalability question, the mod_pubsub Python server is theoretically > quite scalable, since it doesn't use separate threads for different > connections. However, this has not been tested beyond a few dozen. I believe it was tested up to a few thousand in 2001, but since it's select()-based, it doesn't scale well beyond that; and in practical use, rather than performance tests, it may have responsiveness problems with a lot of clients --- I audited the code for things that could run arbitrarily long in an event handler in 2001, and found several dozen, mostly related to very large events. It would not take a lot of work to get it to work well for several tens of thousands of concurrent connections, at least in controlled tests. Probably the easiest way is to switch it from asyncore to Twisted. It wouldn't be a bad idea to run the possibly-arbitrarily-slow stuff in a pool of threads, and threading in Python is pretty easy, but of course then you have to deal with concurrency problems. Apache is *not* very scalable when it comes to dealing with lots of concurrent connections. It's very scalable to lots of transactions per second, just like Tomcat, but it doesn't cope well with long-lived clients either. - Kragen |