When the server experience traffic increase there is a strange memory leak which inflates memory used from 600m to ±3gb and after few minutes it goes back to 600mb. This also spikes CPU usage and makes the server unresponsive.
I found this thread https://github.com/socketio/socket.io/issues/3477 which says that disabling perMessageDeflate solves the issue.
How can I disable perMessageDeflate in socket.io?
To disable perMessageDeflate
import http from 'http';
import express from 'express';
const app = express();
const server = http.createServer(app);
require('socket.io').listen(server, {perMessageDeflate: false});