Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HTTP/2 server settings after .listen() #35353

Closed
szmarczak opened this issue Sep 25, 2020 · 2 comments
Closed

Update HTTP/2 server settings after .listen() #35353

szmarczak opened this issue Sep 25, 2020 · 2 comments
Labels
feature request Issues that request new features to be added to Node.js. http2 Issues or PRs related to the http2 subsystem.

Comments

@szmarczak
Copy link
Member

Is your feature request related to a problem? Please describe.

Currently it is possible to create an HTTP/2 in the following way:

const server = http2.createSecureServer({
	settings: {
		maxConcurrentStreams: 1000
	},
	key,
	cert
});

Let's assume you're having a server and it detected it's low on resources. Limiting maxConcurrentStreams could have a positive impact. Unfortunately it's not possible at the moment.

Describe the solution you'd like

server.updateSettings({
	maxConcurrentStreams: 100
});

Describe alternatives you've considered

None yet.

@szmarczak
Copy link
Member Author

A very sketchy workaround looks like this:

	const kOptions = Object.getOwnPropertySymbols(server).find(x => x.toString() === 'Symbol(options)');
	server[kOptions].settings = {maxConcurrentStreams: 100};

@ZYSzys ZYSzys added feature request Issues that request new features to be added to Node.js. http2 Issues or PRs related to the http2 subsystem. labels Sep 26, 2020
@Vboivin
Copy link
Contributor

Vboivin commented Sep 26, 2020

@ZYSzys I'll take this issue, if nobody is working on it

Trott pushed a commit to Vboivin/node that referenced this issue Oct 23, 2020
Allow the user to update the server settings
after using http2.createSecureServer() or
after using http2.createServer().

Fixes: nodejs#35353
targos pushed a commit that referenced this issue Nov 3, 2020
Allow the user to update the server settings
after using http2.createSecureServer() or
after using http2.createServer().

Fixes: #35353

PR-URL: #35383
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
targos pushed a commit that referenced this issue May 1, 2021
Allow the user to update the server settings
after using http2.createSecureServer() or
after using http2.createServer().

Fixes: #35353

PR-URL: #35383
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants