In our previous post, we have developed a basic real-time collaborative application.

In this post, we are going to scale this system.

Our application is perfectly fine for small projects. Let’s say we have added more features to it and we want to deliver this application to the end-user.

To make this application production-ready we need to make sure this is scalable and always available to our customers.

Vertical scale

It involves upgrading our instance or add an extra resource to support increasing workload.

Horizontal scale

The distributed strategy of adding copies running the same task in parallel.

Both of them have separate pros and cons and different use cases based on different scenarios. But, in enterprise applications, the horizontal scale is quite popular.

Socket scale

In our application, we are using socket to handle real-time operations and the socket internally uses a TCP port to establish a connection. The maximum number of TCP sessions a single source IP can make to a single destination IP and port is 65,535. So, we can only have a maximum of 65K of connection at a time with a single instance.

There are two ways to solve this issue,

  1. Assign IPs to an instance and have ports associated with it. This way we can have maximum connection = number of IP * 65K
  2. Running multiple instances.

The problem of assigning IPs to an instance is manual workload with limited capacity. For that reason, we’ll be moving forward with multiple instances. And this way we’ll have the benefit of scaling out more as per need.

#nodejs #socketio #programming #node

Scale A Real-time Collaborative Editor
1.45 GEEK