Mastering Node.js - Second Edition
Sandro Pasquali, Kevin Faaborg, Glenn Geenen
- 498 pages
- English
- ePUB (adapté aux mobiles)
- Disponible sur iOS et Android
Mastering Node.js - Second Edition
Sandro Pasquali, Kevin Faaborg, Glenn Geenen
Ă propos de ce livre
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.
Foire aux questions
Informations
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)