Technology stack for keep-alive web site
The most common technology stack for websites is Lamp, partly because it's available everywhere, and partly because the programming model is so simple: every request to the server generates a single call to the code and a single chunk of HTML sent back.
But consider the requirements for a Web program that needs keep-alive functionalit开发者_JAVA技巧y, a continuous live stream of data to a Javascript front-end. The impression I get from e.g. "Connection: Keep-Alive" in server response, http://ajaxian.com/archives/mibbit-ajax-based-irc-client and http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/ is that Lamp is just not designed for this type of workload.
So my question is, for a keep-alive workload (is that the best terminology?), what's the best technology stack?
Or to be more precise, what's the best stack by the criteria of reliability, scalability (I don't care about saving a few CPU cycles, but I do care about not getting into a situation where the thing falls over when you add a few more users, even on good high-end hardware) and ubiquity (being able to get started on cheap GoDaddy style hosting)?
nodejs is designed for this sort of workload, it's fast and scales well for this type of workload (much faster than LAMP with AJAX calls back to apache/mod_php + mysql). There are already a decent number of libraries and even some frameworks already out there for it, but there isn't a reason you can't mix and match lamp with node depending on your requirements.
精彩评论