A note on the webserver


Do we still need a complete webserver the likes of apache, for todays server-side dynamic frameworks? No – we don’t.

If you ask why, think about what a webserver is for (a good look at the HTTP spec and apache docu will do). It is responsible for content-types, authentication or help with caching and can also do name-mangling, load-balancing and more with the help of plugins. Now, which of these can a dynamic-language framework also do or even do better? Yep, that’s right, all of them.

The scripting language of choice decides everything for its own dynamic content: The content-type, caching-directives, how to handle each path and even which VM is least loaded for balancing. Authentication is in almost all cases not done through the primitive http-auth anymore, but with the help of the DB and sessions.

If a request for CGI content comes in, the webserver just passes it to the scripting language which takes care of everything itself and passes the result back to the webserver for sending to the client.

Let me emphasize that: The webserver is one more step in the loop, which we don’t need anymore for dynamic content.

Static content, like images, should be served from a different (sub-) domain anyway for easier  CDN distribution, and for that webservers are still the handler of choice.

That’s why frameworks like RoR come with their own lightweight webserver.

Reblog this post [with Zemanta]