
- 498 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Mastering Node.js - Second Edition
About this book
Expert techniques for building fast servers and scalable, real-time network applications with minimal effort; rewritten for Node.js 8 and Node.js 9About This Book⢠Packed with practical examples and explanations, Mastering Node.js contains everything you need to take your applications to the next level.⢠Unleash the full potential of Node.js 9 to build real-time and scalable applications.⢠Gain in-depth knowledge of asynchronous programming, event loops, and parallel data processing.⢠Explore Node's innovative event-non-blocking design, and build professional applications with the help of detailed examples.Who This Book Is ForThis book is targeted at JavaScript developers who want to take an in-depth look at the latest Node.js framework to create faster, scalable, real-time backend applications. Basic JavaScript programming knowledgeāand also some previous Node.js development experienceāare mandatory to get the best out of this bookWhat You Will Learn⢠Build an Electron desktop app using Node that manages a filesystem ⢠Explore Streams and understand how they apply to building networked services ⢠Develop and deploy an SMS-driven customer service application⢠Use WebSockets for rapid bi-directional communication⢠Construct serverless applications with Amazon Lambda ⢠Test and debug with headless browsers, CPU profiling, Mocha, Sinon, and more⢠Scale applications vertically and horizontally across multiple cores and web servicesIn DetailNode.js, a modern development environment that enables developers to write server- and client-side code with JavaScript, thus becoming a popular choice among developers.This book covers the features of Node that are especially helpful to developers creating highly concurrent real-time applications. It takes you on a tour of Node's innovative event non-blocking design, showing you how to build professional applications. This edition has been updated to cover the latest features of Node 9 and ES6. All code examples and demo applications have been completely rewritten using the latest techniques, introducing Promises, functional programming, async/await, and other cutting-edge patterns for writing JavaScript code. Learn how to use microservices to simplify the design and composition of distributed systems. From building serverless cloud functions to native C++ plugins, from chatbots to massively scalable SMS-driven applications, you'll be prepared for building the next generation of distributed software.By the end of this book, you'll be building better Node applications more quickly, with less code and more power, and know how to run them at scale in production environments.Style and approachMastering Node.js contains all of the examples and explanations you'll need to build applications in a short amount of time and at a low cost, running rapidly and at scale.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Scaling Your Application
but the two are distinct: performance measures the speed with which a single request can be executed, while scalability measures the ability of a request to maintain its performance under increasing load. For example, the performance of a request may be reported as generating a valid response within three seconds, but the scalability of the request measures the request's ability to maintain that three-second response time as the user load increases."
When to scale?
Network latency
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(2112) ab -n 10000 -c 100 http://yourserver.com/
Concurrency Level: 100
Time taken for tests: 9.658 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1120000 bytes
HTML transferred: 110000 bytes
Requests per second: 1035.42 [#/sec] (mean)
Time per request: 96.579 [ms] (mean)
Time per request: 0.966 [ms] (mean, across all concurrent requests)
Transfer rate: 113.25 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 6
Processing: 54 96 11.7 90 136
Waiting: 53 96 11.7 89 136
Total: 54 96 11.6 90 136
Percentage of the requests served within a certain time (ms)
50% 90
66% 98
...
99% 133
100% 136 (longest request)
Table of contents
- Title Page
- Copyright
- Credits
- About the Authors
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- Understanding the Node Environment
- Understanding Asynchronous Event-Driven Programming
- Streaming Data Across Nodes and Clients
- Using Node to Access the Filesystem
- Managing Many Simultaneous Client Connections
- Creating Real-Time Applications
- Using Multiple Processes
- Scaling Your Application
- Microservices
- Testing Your Application
- Organizing Your Work into Modules
- Creating Your Own C++ Add-ons