Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.js on Windows - jscamp.asia 2012

Node.js on Windows - jscamp.asia 2012

Tomasz Janczuk

November 30, 2012
Tweet

Other Decks in Technology

Transcript

  1. Node.js  on  Windows.   Undisclosured.   Tomasz  Janczuk   Engineer,

     Microso<   @tjanczuk,  github.com/tjanczuk,  tomasz.janczuk.org     jscamp.asia  2012  
  2. w3wp.exe   node.exe   node.exe   Two  ways  to  run

     on  Windows   node.exe   iisnode   TCP   libuv   HTTP   applicaGon   TCP   HTTP.SYS   IIS   iisnode   named  pipes   libuv   HTTP   applicaGon  
  3. Ways  to  run  in  Windows  Azure   Virtual   Machine

                Linux   or   Windows   Hosted   Service             Managed   applica;on   with  VM   access  on   Windows         Web   Site             Managed   HTTP   applica;on   with  Git,   GitHub,  FTP   and  TFS   deployment     Mobile   Service             Backend  for   Windows  8,   Windows   Phone  or   iPhone   applica;on    
  4. Ways  to  run  in  Windows  Azure   Virtual   Machine

      Hosted   Service   Web   Site   Mobile   Service   node.exe   iisnode  
  5. You  don’t  need  Windows  to  run  on   Windows  Azure

      Web   Site   iisnode   npm  install  azure  
  6. node.js  +  express  on  iisnode   320  machines   8

     data  centers   2  billion  requests/day  peak   45k  requests/second  peak   kernel  mode  output  caching     Web   Site   iisnode  
  7. w3wp.exe   node.exe   node.exe   Two  ways  to  run

     on  Windows   node.exe   iisnode   TCP   libuv   HTTP   applicaGon   TCP   HTTP.SYS   IIS   iisnode   named  pipes   libuv   HTTP   applicaGon  
  8. w3wp.exe   node.exe   node.exe   Two  Three  ways  to

     run  on  Windows   node.exe   iisnode   TCP   libuv   HTTP   applicaGon   TCP   HTTP.SYS   IIS   iisnode   named  pipes   libuv   HTTP   applicaGon   node.exe   TCP   HTTP.SYS   libuv   applicaGon   hIp.sys   hZps://github.com/tjanczuk/hZpsys    
  9. Performance  and  output  caching   hZps://github.com/tjanczuk/hZpsys   hZp://tomasz.janczuk.org/2012/08/the-­‐hZpsys-­‐stack-­‐for-­‐nodejs-­‐apps-­‐on.html    

    12461   17364   159902   0   40000   80000   120000   160000   node.js   hZp.sys   hZp.sys  +  output  caching   requests/second   Throughput,  1  node.exe  process  
  10. Output  caching   var  hZp  =  require('hZpsys').hZp();     hZp.createServer(funcGon

     (req,  res)  {      res.writeHead(200);      res.cacheDura;on  =  60;  //  cache  for  60s      res.end(’Hello,  world!');   }).listen(8080);   hZps://github.com/tjanczuk/hZpsys    
  11. Port  sharing   var  hZp  =  require('hZpsys').hZp();     hZp.createServer(funcGon

     (req,  res)  {      res.writeHead(200);      res.end(’Second  app!');   }).listen(‘hIp://*:80/second’);   var  hZp  =  require('hZpsys').hZp();     hZp.createServer(funcGon  (req,  res)  {      res.writeHead(200);      res.end(’First  app!');   }).listen(‘hIp://*:80/first’);   hZps://github.com/tjanczuk/hZpsys    
  12. Tripwire  to  the  rescue           require('tripwire’).resetTripwire(2000);

        while(true);  //  excep;on  a[er  2000ms   hZps://github.com/tjanczuk/tripwire  
  13. Tripwire  to  the  rescue   process.on('uncaughtExcepGon',  funcGon  (e)  {  

       console.error(’Event  loop  was  blocked!’);      process.exit(1);  });     require('tripwire’).resetTripwire(2000);     while(true);  //  excep;on  a[er  2000ms   hZps://github.com/tjanczuk/tripwire  
  14. Open  sourced  and  undisclosured   npm  install  azure-­‐cli   hZps://windowsazure.com

        github.com/tjanczuk   github.com/windowsazure   @tjanczuk   `