Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

share TLS sessions in HTTPS client agent #7113

Closed
othiym23 opened this issue Feb 13, 2014 · 6 comments
Closed

share TLS sessions in HTTPS client agent #7113

othiym23 opened this issue Feb 13, 2014 · 6 comments

Comments

@othiym23
Copy link

TLS session creation is expensive in high-load scenarios (like SSL termination on load balancers). It would be very useful for core to offer an option on the agent to pool TLS connections or otherwise minimize session creation for clients that are going to be sending lots of SSL traffic to a specific host. This can be worked around with a custom Agent, but it's a common enough use case (and has a small enough API surface) that it would be worth the effort to bring into core.

@indutny
Copy link
Member

indutny commented Feb 13, 2014

Considering maxSockets: 1, suggested by @tjfontaine, resolving this ticket would require reusing sessions between clients in agent pool.

@indutny indutny added this to the v0.13 milestone Feb 28, 2014
@indutny indutny modified the milestones: v0.12, v0.13 Feb 28, 2014
@indutny indutny self-assigned this Feb 28, 2014
@bodokaiser
Copy link

@indutny @othiym23 any updates on this? https.request takes at the moment 6x more time then xhrs from chrome canary.

@bodokaiser
Copy link

This paypal blog post shares some interesting insights.

I did not get how overwriting Agent.prototype.createConnection works. Also I using the alternative cipher with the ssl key and cert slowed done the requests to ~800ms.

However I got success by setting these options:

var agent = new https.Agent({
  "keepAlive": true,
  "keepAliveMsecs": 3000,
  "maxSockets": 100
});

This boils request time down to ~210ms which is OK for the moment.

@jasnell
Copy link
Member

jasnell commented Jun 22, 2015

@othiym23 @indutny ... any further thoughts on this?

@indutny
Copy link
Member

indutny commented Jun 29, 2015

Going to take a look.

@indutny
Copy link
Member

indutny commented Jul 23, 2015

Fix is here: nodejs/node#2228

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants