Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Building Scalable Apps with Redis and Node.js
  • Table Of Contents Toc
Building Scalable Apps with Redis and Node.js

Building Scalable Apps with Redis and Node.js

By : Joshua Johanan
4.3 (9)
close
close
Building Scalable Apps with Redis and Node.js

Building Scalable Apps with Redis and Node.js

4.3 (9)
By: Joshua Johanan

Overview of this book

If the phrase scalability sounds alien to you, then this is an ideal book for you. You will not need much Node.js experience as each framework is demonstrated in a way that requires no previous knowledge of the framework. You will be building scalable Node.js applications in no time! Knowledge of JavaScript is required.
Table of Contents (12 chapters)
close
close
11
Index

Taking heap snapshots


In JavaScript, a heap snapshot will have all the objects that are not going to be garbage collected. This is perfect for tracking down memory leaks. We had briefly touched on memory leaks in Chapter 6, Using Bower to Manage Our Frontend Dependencies. Here, we will create some memory leaks on both the backend and frontend to see what they look like.

First, we will create a memory leak in Node.js. Create a new file named leak.js and put the following code into it:

var agent = require('webkit-devtools-agent');
var express = require('express');
var app = express();
var http = require('http');
var server = http.createServer(app);

server.setMaxListeners(1000000);
app.use(express.static(__dirname + '/static'));

app.get('/', function(req, res){
  //no-op listener
  for(var k=0; k < 1000; k++){
    server.on('request', function(e){var t = express;});
  }
  res.set('Important-Header', 'test-value');
  res.send('hello world<script src="/debug.js"></script>');
}...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Building Scalable Apps with Redis and Node.js
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon