Posts

Showing posts from 2013
A Snake in the Whirlwind Non-blocking I/O web servers are kind of a newish thing around, so there aren't many of them at the moment. Web servers are aplenty. Few of them, called lightweight web servers , are supposed to be very fast. But these are all general purpose web servers and none of them is programable by web application developers. This relatively new kind of non-blocking I/O web servers based on some server-side scripting languages is in another category whatsoever. These are libraries/frameworks used for writing network applications, and not really web servers. Actually, application that you write becomes (or contains) your very own web server. Tornado is the first of the kind to be reviewed here. Before we proceed to it just brief discussion on sockets, which was perhaps due in the post about non-blocking I/O, but better late than never. Protocols, Ports and Sockets On Unix, including its derivatives like Linux, everything is a file . Including I/O d
Image
Test site You might have noticed beautiful blue button to the right with the inscription “Test site”. If you venture to click on it, web page http://web-appz.hp.af.cm/ will open in the new tab. In it you'll see this:                             Node.js testing site for web-appz.blogspot.com I agree, it's not much. To be honest it is less than “not much”, but it is a beginning. Behind the page is this illustrious code: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Node.js testing site for <a href="http://web-appz.blogspot.com">web-appz.blogspot.com</a>'); }).listen(process.env.VMC_APP_PORT || 1337, null); The experience with appfog was so satisfactory that I think it would be fair to share it. AppFog https://www.appfog.com/ is where the test site is hosted. I went there, I clicked “Sign Up” and was redirected to their s
Image
Web Servers and the Zen of Non-blocking I/O This post started as a short introduction to the first one in a mini-series of head-to-head comparisons of three non-blocking I/O web servers. And then things got out of control. Being as it is, I convinced myself that a bit more elaborate introduction is in order. Now comes the hard part, to convince everyone else. Web servers Web servers are complicated machines, both hardware and software-wise. The illustration below shows block diagram of a typical web server based on LAMP ( L inux A pache M ySQL/ M ariaDB) P erl/ P HP/ P ython) bundle (or stack as some prefer to say). LAMP bundle web server Told' ya it was complicated, didn't I? And this is just a block diagram. There are variants of this stack, such as WAMP ( W indows A pache M ySQL/ M ariaDB) P erl/ P HP/ P ython). By the way, these bundles are really easy to install. Companies like TurnKey Linux offer a number of software appliances based on Linux in n
Why !(!(node.js))   No one in his right mind would kill his main character in the third chapter of his suspense/thriller/drama blog about web apps, so the above title is not a mistake. There certainly is an extra set of parenthesis, but I wanted to add emphasis. In the first post I tried to make my personal case for node.js, and in this one I shall look into some of the most used counterarguments. JavaScript is slow Inherently, node.js which is based on it, is slow   Well, all web scripting languages are slow . That is because they are interpreted languages . Programs written in these languages need a runtime ( runtime interpreter to be precise) to work. And the runtime is just a program that reads your file and tries to interpret the commands. It is usually (read: always) written in some high speed compiled language (think C/C++). Anyone can create his or hers programming language. All you have to do is invent your own syntax, play around with Lex long enough to im