Node.js High Performance

Book description

Take your application to the next level of high performance using the extensive capabilities of Node.js

About This Book

  • Analyze, benchmark, and profile your Node.js application to find slow spots, and push it to the limit by eliminating performance bottlenecks
  • Learn the basis of performance analysis using Node.js
  • Explore the high performance capabilities of Node.js, along with best practices

In Detail

Node.js is a tool written in C, which allows you to use JavaScript on the server-side. High performance on a platform like Node.js is knowing how to take advantage of every aspect of your hardware, helping memory management act at its best, and correctly deciding how to architect a complex application. Do not panic if your applications start consuming a lot of memory; instead spot the leak and solve it fast with Node.js by monitoring and stopping it before it becomes an issue.

This book will provide you with the skills you need to analyze the performance of your application and monitor the aspects that can and should be. Starting with performance analysis concepts and their importance in helping Node.js developers eliminate performance bottlenecks, this book will take you through development patterns to avoid performance penalties. You will learn the importance of garbage collection and its behaviour,and discover how to profile your processor, allowing better performance and scalability.

You will then learn about the different types of data storage methods. Moving on, you will get to grips with testing and benchmarking applications to avoid unknown application test zones. Lastly, you will explore the limits that external components can impose in your application in the form of bottlenecks.

By following the examples in each chapter, you will discover tips to getting better performing applications by avoiding anti-patterns and stretching the limits of your environment as much as possible.

What You Will Learn

  • Develop applications using well-defined and well-tested development patterns
  • Explore memory management and garbage collection to improve performance
  • Monitor memory changes and analyze heap snapshots
  • Profile the CPU and improve your code to avoid patterns that force intensive processor usage
  • Understand the importance of data and when you should cache information.
  • Learn to always test your code and benchmark when needed
  • Extend your application's scope and know what other elements can influence performance

Who This Book Is For

This book is for Node.js developers who want a more in-depth knowledge of the platform to improve the performance of their applications. Whether you have a base Node.js background or you are an expert who knows the garbage collector and wants to leverage it to make applications more robust, the examples in this book will benefit you.

Style and approach

This is a practical guide to learning high performance, which even the least experienced developer will comprehend. Small and simple examples help you test concepts yourself and easily adapt them to any application, boosting its performance and preparing it for the real-world.

Table of contents

  1. Node.js High Performance
    1. Table of Contents
    2. Node.js High Performance
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Introduction and Composition
      1. Performance analysis
        1. Monitoring
      2. Getting high performance
        1. Testing and benchmarking
        2. Composition in applications
          1. Using NPM
          2. Separating your code
          3. Embracing asynchronous tasks
          4. Using library functions
          5. Using function rules
          6. Testing your modules
      3. Summary
    9. 2. Development Patterns
      1. What are patterns?
      2. Node.js patterns
      3. Types of patterns
        1. Architectural patterns
        2. Creational patterns
        3. Structural patterns
        4. Behavioral patterns
      4. Event-driven architecture
        1. Streams
        2. Buffers
      5. Optimizations
        1. Hidden types
        2. Numbers
        3. Arrays
        4. Functions
        5. The for-in loops
        6. The infinite loops
        7. The try-catch blocks
        8. Eval
      6. Summary
    10. 3. Garbage Collection
      1. Automatic memory management
        1. Memory organization
        2. Memory leaks
        3. Event emitters
        4. Referencing objects
        5. Object representation
        6. Object heaps
        7. Heap snapshots
        8. Third-party management
      2. Summary
    11. 4. CPU Profiling
      1. The I/O library
        1. Fibonacci
        2. Flame graphs
        3. Profiling alternatives
      2. Summary
    12. 5. Data and Cache
      1. Data storage
        1. Excessive I/O
      2. Database management systems
        1. Caching data
        2. Asynchronous caching
        3. Clustering data
        4. Accessing data
      3. Summary
    13. 6. Test, Benchmark, and Analyze
      1. Test fundamentals
        1. The test environment
        2. The Docker tool
        3. The test tool
        4. Continuous integration
          1. Code coverage
        5. Benchmark tests
        6. Analyzing tests
      2. Summary
    14. 7. Bottlenecks
      1. Host limits
        1. Network limits
        2. Client limits
        3. Browser limits
        4. Performance variables
      2. Summary
    15. Index

Product information

  • Title: Node.js High Performance
  • Author(s): Diogo Resende
  • Release date: August 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781785286148