Web applications are so boring! It's always the same old request->response, request->response, request->response, ad infinitum. Yawn!
Wait, but how could I forget all the cool innovations of the past few years??? We have AJAX, Rails, GWT, Flash, ActiveX -- just kidding!!!! -- wikis, blogs, Google...
Trust me, I did not forget them, but I still feel trapped in a request->response world, and this world is driven by the same old recycled beat, almost like the mind numbing output of monopoly controlled airwaves.
Well, I admit the situation isn't that bad, but I wanted to use the metaphor, ok? :)
Imagine what the web would look like if every connected node could send a message to every other node in (soft ;)) real-time. How would Ebay, MySpace, Wikipedia, Blogger, Match, etc, look if users could actually communicate with each other instantly??? How would these sites look if their backends could send messages to the users and route communications between the users and 3rd party servers -- and all of this would happen with milliseconds' delay???
Well, I don't know to be honest, but I can think of a few ideas that make those websites look like interesting, very profitable, but ultimately anachronistic experiments. I do know, though, that Ebay's executives understood that instant communications facilitate transactions when they decided to buy Skype for $4,100,000,000.
Let's go back to the technologies. AJAX is not boring actually, because it does open the doors to real interactivity, as Meebo demonstrates. The problem with the predominant web paradigm these days isn't the browser: it's the fact that all backends are variations on the same old architecture, where the server hands if off each request to a dedicated OS thread which processes the request and sends the response. Then, sayonara.
The backends of 99.9999% of all webapps are stuck in a CRUD mentality, and that's not the fault of web developers. It stems from the fact most language designers and OS developers apparently haven't worried so much about building software tools that scale to tens or hundreds of thousands of simultaneous processes, which prevents the imaginations of most web developers from going to the bidirectional realm. Could one build a web application than maintains persistent connections to all clients with one of today's common web development languages? Sure. But this probably wouldn't scale, and it would be expensive to operate and difficult to maintain.
Getting those web servers to talk to each other is also outside of what most web development frameworks offer.
At this point you probably know where I'm going with this: Erlang. Erlang can scale to millions of simultaneous processes -- on one machine! (I wrote about this more here and here). If you write your backend in Erlang, the VM handles concurrency gracefully. You can keep those damn connections alive -- and then set your mind free :)
Erlang also lets you easily form a cluster from web servers with replicated "live" session data, which is possible, but not as easy to do with other languages.
Meebo shows you can build such applications in a scalable way with other languages -- in Meebo's case, C++. Other languages just make it hard. The best solution I can think of is to run a single-threaded, non-blocking HTTP server that hands off long, blocking tasks to workers in a thread pool. But that thread pool had better not grow too much, because then you're back where you started: scalability bottlenecks. Yikes. Oh, and if you want to easily set up a cluster between your web servers, upgrade the servers without taking them offline and thereby booting away connected users, or set up supervision hierarchies for graceful error recovery, you're in for a good amount of work.
(Meebo actually "cheats" because the AIM, ICQ, Yahoo Messenger, and GTalk servers do the "real" routing. Other applications may require their own routing, a feature that one could build with Erlang with ease.)
It's no surprise that Erlangers are already developing a Real-Time Wiki -- the kind of app whose scalability implications would be quite intimidating for non-Erlangers. This project is based on an ejabberd backend, which isn't a "traditional" web server, but there's no reason one couldn't build the same thing on top of Yaws, which has most of the dynamic web application development tools and AJAX integration you need. Just think of Yaws + Mnesia as an application server that also happens to be a telcom-grade message router with a distributed soft real-time peer database that's shared among all nodes in the cluster, and all the pieces will just fall into place :)
Ok, I've done enough rambling for one evening. I just wish I had the time to build all those cool Erlang apps I want to build.
1 comment:
You covered the serverside and I just studied today about the clientside of next generation webapps: http://www.whatwg.org/specs/web-apps/current-work/
Today you need to use the flashplayer and/or monster Javascript frameworks as dojo for some of the advanced stuff.
Post a Comment