O'Reilly logo

Socket.IO Cookbook by Tyson Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing load balancing with the Nginx server

Nginx is a free, open source, high-performance HTTP server, and reversed proxy. Unlike traditional servers, Nginx doesn't rely on threads to handle requests. Instead, it uses a much more scalable asynchronous architecture. This architecture uses small and predictable amounts of memory under load.

We can use Nginx to load-balance our node servers and, if it is configured correctly, we won't have to worry about requests being lost between the original handshake and the callback when events are received.

Getting ready

Before we can do effective load balancing with the Nginx server, we will need to install it. Nginx can be installed with Homebrew with the following code:

brew install nginx

Once Nginx is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required