Rob is a professional IT specialist with over 14 years of commercial expertise working for small, medium and large enterprise customers and clients as well as local, state and federal governments within Australia and internationally. Of these fourteen years, six have been served in a professional consultancy capacity, three as a project manager and eleven years in professional software engineering and architecture. Rob is a DZone MVB and is not an employee of DZone and has posted 58 posts at DZone. You can read more from them at their website. View Full User Profile

Notes on Node.js and Windows Azure

09.13.2012
| 3081 views |
  • submit to reddit

Notes from a Level 200 session by Nathan Totten.  I'm live blogging from TechEd Australia...

Node.js is an open source/open framework built on Google’s Chrome engine.

JavaScript on the server… Event drive I/O server-side JavaScript. ; Runs on a single thread..Not thread based, therefore small heap allocation. ; Efficient and scalable.

All operations are essentially queued, and actioned by the single thread. ; The thread can’t afford to hang!

Good At

  • Realtime comms/quick chatty interfaces
  • REST interfaces
  • JSON web services
  • Client oriented web-apps/UI

Bad At (or not great at)

  • Forms over CRUD (can be done, but maybe not the best choice)
  • CPU intensive processing (don’t render media, images.. too intensive)

Pros

  • JavaScript – common language
    • Not a lot of standardization, different styles
  • Clean API
  • Simple concurrency model (is it concurrent??)
  • Idle connections cost next to nothing
  • Modular

Cons

  • Not a lot of standard framework inclusions
    • No particular testing framework etc
  • Young, still developing
  • Bare metal.. not for the inexperienced.. not great IDE support etc

Application Frameworks

  • Connect
  • express
  • geddy
  • (fab)

Node.js on Windows

Native build on Windows. ; Ported from Linux, can host Node processes on IIS with IISNode, which gives the benefits of IIS. ; Modules which work on other platforms will work on Windows. ; Contains package manager support from the commandline.

Node.js on IIS

  • Process management
  • Access to logs
  • Side-by-side with other content
  • Scalability on multi-core
  • Auto-update
  • Minimal node code changes
  • integrated management experience

Showing how to implement a HTTP server variable in Node.js script. ; Can be self hosted? ; Implements a web server (single threaded?). ; Command line tools written in Node.js. ; Windows Azure tools included.

Most Node.js/Windows Azure functionality can be developed without visiting the Azure control panel page. ; Supports inline GIT support – interesting. ; A bit of deployment pain as access is denied. ; Heading to the Azure Control Panel after all…

20120912-172743.jpg

20120912-172751.jpg

Using the command line to invoke the server side GIT repository to create the appropriate folders. This might be tough for non-GIT users to follow. TFS users looking baffled.

Packages being pulled down (like NuGet), but on the Azure server side. Site is now up and running. Deployment history is tracked on the Azure side. This allows rollback functionality. The GIT integration is quite nicely done.  Somewhere Ted Buchan is grinning.

Deployments look pretty impressive, but a knowledge of GIT would be most handy.

Debugging Node.js

There’s something called a NodeInspector. It runs in a web browser (but not Internet Explorer), so now we’re loading Google Chrome...ironic. It’s a matter of putting the Node server into debug mode.

NodeInspector...why does that remind me of Inspector Gadget? Go go Node [thing]!

20120912-173711.jpg
Node Inspector

Yes, you can also remote debug assuming the correct ports are opened.

Node Supervisor

Watches files for changes..  Otherwise, to void the cache, you’d have to restart the Node server.  Installed as a package through command line:  npm install node-inspector –g

Socket.IO

Enables poling, web socket style functionality.  Installs as per command line.  Works on almost any browser, real-time communication requires long polling or web sockets.

20120912-174553.jpg
Socket.IO supported

As Azure is running currently on Windows Server 2008 R2, and that only IIS 8 (Server 2012) supports web sockets, as a consequence the current Node.js support in Azure needs to use long polling (as mentioned before).  This will be changed...soon.

Head to github to find out more – this is open source stuff.

There are undoubtedly some interesting uses for this approach. It will be one to watch.

Published at DZone with permission of Rob Sanders, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)