fix: set maxConcurrentStreams for http2 so it can be load-balanced reasonably

This commit is contained in:
Yanlong Wang 2025-05-07 18:24:19 +08:00
parent 01539b7300
commit a9fe036ddc
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37
3 changed files with 12 additions and 0 deletions

View File

@ -44,6 +44,10 @@ export class CrawlStandAloneServer extends KoaServer {
const ar = new AsyncResource('HTTP2ServerRequest');
ar.runInAsyncScope(fn, this.koaApp, req, res);
});
// HTTP2 p2p may break the load balancing
this.httpServer.updateSettings({
maxConcurrentStreams: 8,
});
// useResourceBasedDefaultTracker();
return this;

View File

@ -44,6 +44,10 @@ export class SearchStandAloneServer extends KoaServer {
const ar = new AsyncResource('HTTP2ServerRequest');
ar.runInAsyncScope(fn, this.koaApp, req, res);
});
// HTTP2 p2p may break the load balancing
this.httpServer.updateSettings({
maxConcurrentStreams: 8,
});
// useResourceBasedDefaultTracker();
return this;

View File

@ -45,6 +45,10 @@ export class SERPStandAloneServer extends KoaServer {
const ar = new AsyncResource('HTTP2ServerRequest');
ar.runInAsyncScope(fn, this.koaApp, req, res);
});
// HTTP2 p2p may break the load balancing
this.httpServer.updateSettings({
maxConcurrentStreams: 50,
});
// useResourceBasedDefaultTracker();
return this;