SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
node.js
production site architecture
About me
 Ben Lin
A full time entrepreneur & JavaScript lover
Fall in love with node.js on Jun 2011




                                                      dreamerslab.com
                                               ben@dreamerslab.com
                                              twitter.com/dreamerslab
                                              github.com/dreamerslab
About me

COKE - Full stack node.js MVC framework
Vodka - Functional testing framework
Thunder - The lightning fast template engine


      https://github.com/dreamerslab
Agenda
  1. Super brief intro to node.js
  2. Run node as a service
  3. What if it crashes?
  4. Monit VS Forever
  5. Nginx or not
  6. Scaling node.js
  7. Deployment
  8. Cloud service
  9. Some useful tips
 10. Q & A
What is node?



 node is an evented, non-blocking I/O
 server-side Javascript built on chrome V8
What is node?

Ryan Dahl talks about the history of
node.js


   http://www.youtube.com/watch?v=SAc0vQCC6UQ
What is node?

 But why node?


     * node is fast
     * node handles a lot of connection with very little resources
     * You can develop your whole app with one language
     * Easy to scale
What is node?



  Achieves this by all making network I/O
  nonblocking and all file I/O asynchronous.
What is node?

 I/O latency

     L1: 3 cycles
     L2: 14 cycles
     RAM: 250 cycles
     DISK: 41,000,000 cycles
     NETWORK: 240,000,000 cycles
What is node?



 What’s wrong with PHP, Ruby, Python, etc...?
Run node as a service



  Run your node app as daemon with upstart
Run node as a service


        # Start your app
        start your_app_name

        # Stop your app
        stop your_app_name

        # Restart your app
        restart your_app_name
What if it crashes?



  Every little shit can fuck up your node app
Monitor your node app

  Installation on Ubuntu
  $ sudo apt-get install monit

  Edit configs
   * edit /etc/default/monit and set the "startup" variable to 1
   * edit /etc/monit/monitrc and use the example file monitrc

  Run
  $ sudo /etc/init.d/monit start
  $ sudo monit start your_app_name
Monit VS Forever
Monit VS Forever


  With `forever` we kind of use an unstable
  tool to monitor another unstable project?!
Nginx or not?


* Nginx runs faster with serving static files
* Use it as a reverse proxy to load balance with
multiple nodes
Scaling node.js
Scaling node.js
Start small with built-in static server, node.js app & database all on the same server.
Scaling node.js
Use nginx as static server for better performance.
Scaling node.js
Use nginx as as proxy server as well to load balance requests.
The number of node.js app instance depends on how many CPU cores on the machine.
Scaling node.js
Split static files to different server for easier maintenance.
Scaling node.js
Use aws S3 for easier setup and maintenance.
Scaling node.js
Split database to another server. Make the node.js app server an unit.
Scaling node.js
Add a load balancer, add more app unit as the site scales up.
Scaling node.js
Add replica set if the database hits its limit.
Scaling node.js
Add CDN for static files for cross reign performance.
Scaling node.js
Split app to difference services as it scales up. Previous scaling steps apply to those services too.
Deployment
Deployment
With ssh, git; The server must stop during deployment.
Deployment
With ssh, git; 0 downtime deployment is possible since we have more than 1 instance( repo ).
Deployment
With ssh, git; Split static file makes it easier to deploy with multi instance( repo ) app.
Deployment
Deploying with multi machine it’s better to use image files on aws ec2.
Cloud service
Cloud service




  How about using services like Heroku,
  Nodejitsu, mongoHQ?
Some useful tips
Some useful tips
 Set your max file limit
            sudo vi /etc/security/limits.conf
            # add the following 4 lines
            root soft nofile 51200
            root hard nofile 51200
            * soft nofile 51200
            * hard nofile 51200

            sudo vi /etc/pam.d/common-session
            # add
            session required pam_limits.so

            sudo vi /etc/profile
            # add
            ulimit -SHn 51200
Some useful tips

This ensure that your node app never dies but
use with care

          process.on('uncaughtException', function (e) {
            console.dir(e);
          });
THE END
 Thanks
QUESTIONS?
HIRING
   Web & iOS Dev
Your Github account speak for you,
  Please mail to job@woomoo.in

Contenu connexe

Tendances

Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureColin Mackay
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJSHüseyin BABAL
 
9 anti-patterns for node.js teams
9 anti-patterns for node.js teams9 anti-patterns for node.js teams
9 anti-patterns for node.js teamsJeff Harrell
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJSJITENDRA KUMAR PATEL
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialTom Croucher
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNaveen S.R
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Christian Joudrey
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful APISang Cù
 
The Real World - Plugging the Enterprise Into It (nodejs)
The Real World - Plugging  the Enterprise Into It (nodejs)The Real World - Plugging  the Enterprise Into It (nodejs)
The Real World - Plugging the Enterprise Into It (nodejs)Aman Kohli
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS ExpressDavid Boyer
 

Tendances (20)

Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
 
9 anti-patterns for node.js teams
9 anti-patterns for node.js teams9 anti-patterns for node.js teams
9 anti-patterns for node.js teams
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
 
Node.js for beginner
Node.js for beginnerNode.js for beginner
Node.js for beginner
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Nodejs intro
Nodejs introNodejs intro
Nodejs intro
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful API
 
The Real World - Plugging the Enterprise Into It (nodejs)
The Real World - Plugging  the Enterprise Into It (nodejs)The Real World - Plugging  the Enterprise Into It (nodejs)
The Real World - Plugging the Enterprise Into It (nodejs)
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 

En vedette

Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture AppDynamics
 
Modern UI Development With Node.js
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.jsRyan Anklam
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSMitoc Group
 
Presentation - History of Westinghouse
Presentation - History of WestinghousePresentation - History of Westinghouse
Presentation - History of WestinghouseSandy Manners
 
Javascript Client & Server Architectures
Javascript Client & Server ArchitecturesJavascript Client & Server Architectures
Javascript Client & Server ArchitecturesPedro Melo Pereira
 
Getting Started with the Node.js LoopBack APi Framework
Getting Started with the Node.js LoopBack APi FrameworkGetting Started with the Node.js LoopBack APi Framework
Getting Started with the Node.js LoopBack APi FrameworkJimmy Guerrero
 
Migrating a Monolithic App to Microservices on Cloud Foundry
Migrating a Monolithic App to Microservices on Cloud FoundryMigrating a Monolithic App to Microservices on Cloud Foundry
Migrating a Monolithic App to Microservices on Cloud FoundryTony Erwin
 
Microservices and modern backends - Azure Meetup Frankfurt
Microservices and modern backends  - Azure Meetup FrankfurtMicroservices and modern backends  - Azure Meetup Frankfurt
Microservices and modern backends - Azure Meetup FrankfurtDamir Dobric
 
Building a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusBuilding a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusNGINX, Inc.
 
A High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI CompositionA High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI CompositionAlexey Gravanov
 
Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.jsratankadam
 
Building microservices web application using scala & akka
Building microservices web application using scala & akkaBuilding microservices web application using scala & akka
Building microservices web application using scala & akkaBinh Nguyen
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.jsChris Cowan
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready Nir Kaufman
 
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
Building Scalable Web Applications Using Microservices Architecture and NodeJ...Building Scalable Web Applications Using Microservices Architecture and NodeJ...
Building Scalable Web Applications Using Microservices Architecture and NodeJ...NodejsFoundation
 

En vedette (20)

Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
 
Node.js architecture (EN)
Node.js architecture (EN)Node.js architecture (EN)
Node.js architecture (EN)
 
Modern UI Development With Node.js
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.js
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWS
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
 
Presentation - History of Westinghouse
Presentation - History of WestinghousePresentation - History of Westinghouse
Presentation - History of Westinghouse
 
Keymetrics pm2
Keymetrics pm2Keymetrics pm2
Keymetrics pm2
 
Javascript Client & Server Architectures
Javascript Client & Server ArchitecturesJavascript Client & Server Architectures
Javascript Client & Server Architectures
 
10 google apps
10 google apps10 google apps
10 google apps
 
Getting Started with the Node.js LoopBack APi Framework
Getting Started with the Node.js LoopBack APi FrameworkGetting Started with the Node.js LoopBack APi Framework
Getting Started with the Node.js LoopBack APi Framework
 
Migrating a Monolithic App to Microservices on Cloud Foundry
Migrating a Monolithic App to Microservices on Cloud FoundryMigrating a Monolithic App to Microservices on Cloud Foundry
Migrating a Monolithic App to Microservices on Cloud Foundry
 
Microservices and modern backends - Azure Meetup Frankfurt
Microservices and modern backends  - Azure Meetup FrankfurtMicroservices and modern backends  - Azure Meetup Frankfurt
Microservices and modern backends - Azure Meetup Frankfurt
 
Building a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusBuilding a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX Plus
 
A High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI CompositionA High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI Composition
 
Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.js
 
Building microservices web application using scala & akka
Building microservices web application using scala & akkaBuilding microservices web application using scala & akka
Building microservices web application using scala & akka
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready
 
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
Building Scalable Web Applications Using Microservices Architecture and NodeJ...Building Scalable Web Applications Using Microservices Architecture and NodeJ...
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
 

Similaire à Webconf nodejs-production-architecture

All You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdfAll You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdfiDataScientists
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
Nodejs web service for starters
Nodejs web service for startersNodejs web service for starters
Nodejs web service for startersBruce Li
 
Develop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows AzureDevelop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows AzureAndri Yadi
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopleffen
 
Node.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About itNode.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About itFibonalabs
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sailsBrian Shannon
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous  Blocking or synchronous.pdfNode Js Non-blocking or asynchronous  Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous Blocking or synchronous.pdfDarshanaMallick
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaAmazon Web Services
 

Similaire à Webconf nodejs-production-architecture (20)

02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Node js
Node jsNode js
Node js
 
Nodejs
NodejsNodejs
Nodejs
 
All You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdfAll You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdf
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
Nodejs web service for starters
Nodejs web service for startersNodejs web service for starters
Nodejs web service for starters
 
Proposal
ProposalProposal
Proposal
 
Nodejs
NodejsNodejs
Nodejs
 
Develop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows AzureDevelop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows Azure
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
 
Node J pdf.docx
Node J pdf.docxNode J pdf.docx
Node J pdf.docx
 
Node J pdf.docx
Node J pdf.docxNode J pdf.docx
Node J pdf.docx
 
Node.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About itNode.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About it
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous  Blocking or synchronous.pdfNode Js Non-blocking or asynchronous  Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
 

Plus de Ben Lin

portfolio
portfolioportfolio
portfolioBen Lin
 
DeNA Sharing
DeNA SharingDeNA Sharing
DeNA SharingBen Lin
 
POPAPP INVESTOR DECK
POPAPP INVESTOR DECKPOPAPP INVESTOR DECK
POPAPP INVESTOR DECKBen Lin
 
Heroku pop-behind-the-sense
Heroku pop-behind-the-senseHeroku pop-behind-the-sense
Heroku pop-behind-the-senseBen Lin
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 

Plus de Ben Lin (7)

portfolio
portfolioportfolio
portfolio
 
product
productproduct
product
 
DeNA Sharing
DeNA SharingDeNA Sharing
DeNA Sharing
 
POPAPP INVESTOR DECK
POPAPP INVESTOR DECKPOPAPP INVESTOR DECK
POPAPP INVESTOR DECK
 
Heroku pop-behind-the-sense
Heroku pop-behind-the-senseHeroku pop-behind-the-sense
Heroku pop-behind-the-sense
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Dernier (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Webconf nodejs-production-architecture

  • 2. About me Ben Lin A full time entrepreneur & JavaScript lover Fall in love with node.js on Jun 2011 dreamerslab.com ben@dreamerslab.com twitter.com/dreamerslab github.com/dreamerslab
  • 3. About me COKE - Full stack node.js MVC framework Vodka - Functional testing framework Thunder - The lightning fast template engine https://github.com/dreamerslab
  • 4.
  • 5. Agenda 1. Super brief intro to node.js 2. Run node as a service 3. What if it crashes? 4. Monit VS Forever 5. Nginx or not 6. Scaling node.js 7. Deployment 8. Cloud service 9. Some useful tips 10. Q & A
  • 6. What is node? node is an evented, non-blocking I/O server-side Javascript built on chrome V8
  • 7. What is node? Ryan Dahl talks about the history of node.js http://www.youtube.com/watch?v=SAc0vQCC6UQ
  • 8. What is node? But why node? * node is fast * node handles a lot of connection with very little resources * You can develop your whole app with one language * Easy to scale
  • 9. What is node? Achieves this by all making network I/O nonblocking and all file I/O asynchronous.
  • 10. What is node? I/O latency L1: 3 cycles L2: 14 cycles RAM: 250 cycles DISK: 41,000,000 cycles NETWORK: 240,000,000 cycles
  • 11. What is node? What’s wrong with PHP, Ruby, Python, etc...?
  • 12. Run node as a service Run your node app as daemon with upstart
  • 13. Run node as a service # Start your app start your_app_name # Stop your app stop your_app_name # Restart your app restart your_app_name
  • 14. What if it crashes? Every little shit can fuck up your node app
  • 15. Monitor your node app Installation on Ubuntu $ sudo apt-get install monit Edit configs * edit /etc/default/monit and set the "startup" variable to 1 * edit /etc/monit/monitrc and use the example file monitrc Run $ sudo /etc/init.d/monit start $ sudo monit start your_app_name
  • 17. Monit VS Forever With `forever` we kind of use an unstable tool to monitor another unstable project?!
  • 18. Nginx or not? * Nginx runs faster with serving static files * Use it as a reverse proxy to load balance with multiple nodes
  • 20. Scaling node.js Start small with built-in static server, node.js app & database all on the same server.
  • 21. Scaling node.js Use nginx as static server for better performance.
  • 22. Scaling node.js Use nginx as as proxy server as well to load balance requests. The number of node.js app instance depends on how many CPU cores on the machine.
  • 23. Scaling node.js Split static files to different server for easier maintenance.
  • 24. Scaling node.js Use aws S3 for easier setup and maintenance.
  • 25. Scaling node.js Split database to another server. Make the node.js app server an unit.
  • 26. Scaling node.js Add a load balancer, add more app unit as the site scales up.
  • 27. Scaling node.js Add replica set if the database hits its limit.
  • 28. Scaling node.js Add CDN for static files for cross reign performance.
  • 29. Scaling node.js Split app to difference services as it scales up. Previous scaling steps apply to those services too.
  • 31. Deployment With ssh, git; The server must stop during deployment.
  • 32. Deployment With ssh, git; 0 downtime deployment is possible since we have more than 1 instance( repo ).
  • 33. Deployment With ssh, git; Split static file makes it easier to deploy with multi instance( repo ) app.
  • 34. Deployment Deploying with multi machine it’s better to use image files on aws ec2.
  • 36. Cloud service How about using services like Heroku, Nodejitsu, mongoHQ?
  • 38. Some useful tips Set your max file limit sudo vi /etc/security/limits.conf # add the following 4 lines root soft nofile 51200 root hard nofile 51200 * soft nofile 51200 * hard nofile 51200 sudo vi /etc/pam.d/common-session # add session required pam_limits.so sudo vi /etc/profile # add ulimit -SHn 51200
  • 39. Some useful tips This ensure that your node app never dies but use with care process.on('uncaughtException', function (e) { console.dir(e); });
  • 42. HIRING Web & iOS Dev Your Github account speak for you, Please mail to job@woomoo.in