First of all, Livingston remarked that some of the default cypher algorithms used by Node.js, such as Diffie Hellman and Elliptical Curve, are strong but “hugely expensive and basically cripple Node.js performance when you begin making a lot of outbound SSL calls at default settings.” In a service call, key generation takes up to 87% of the time, according to Livingston. He suggests using an algorithm that takes less resources:

With AES256, the time needed to generate the key was reduced to 32.5% in Livingston’s tests.

Using keep alive – which can raise the number of transactions/sec by more than 50%, according to the author of the keepAliveAgent package. This package won’t be necessary in the upcoming Node.js 0.12.

Optimizing agent.maxSockets – the default number of concurrent sockets per origin is 5 and the number should not be too high because it “can result in a negative performance impact”, according to Livingston.

Exercising caution in adjusting the slab buffer size, because it impacts the garbage collection time at high volumes. This tweak won’t be needed when 0.12 comes out.

Livingston also noted that the upcoming Node.js 0.12 has some improvements that almost doubles the number of requests/sec served when the AES256 algorithm is used.

Reusing sessions. Another advice to improve Node’s performance is to reuse sessions, an idea detailed by Miroslav Bajtoš in an earlier post. For this, one needs to create a sessions store and handle the newSession and resumeSession events. The respective post contains code samples showing session reuse for single-threaded apps and for clusters of worker processes.