nomagick commited on
Commit
a9fe036
·
unverified ·
1 Parent(s): 01539b7

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

Browse files
src/stand-alone/crawl.ts CHANGED
@@ -44,6 +44,10 @@ export class CrawlStandAloneServer extends KoaServer {
44
  const ar = new AsyncResource('HTTP2ServerRequest');
45
  ar.runInAsyncScope(fn, this.koaApp, req, res);
46
  });
 
 
 
 
47
  // useResourceBasedDefaultTracker();
48
 
49
  return this;
 
44
  const ar = new AsyncResource('HTTP2ServerRequest');
45
  ar.runInAsyncScope(fn, this.koaApp, req, res);
46
  });
47
+ // HTTP2 p2p may break the load balancing
48
+ this.httpServer.updateSettings({
49
+ maxConcurrentStreams: 8,
50
+ });
51
  // useResourceBasedDefaultTracker();
52
 
53
  return this;
src/stand-alone/search.ts CHANGED
@@ -44,6 +44,10 @@ export class SearchStandAloneServer extends KoaServer {
44
  const ar = new AsyncResource('HTTP2ServerRequest');
45
  ar.runInAsyncScope(fn, this.koaApp, req, res);
46
  });
 
 
 
 
47
  // useResourceBasedDefaultTracker();
48
 
49
  return this;
 
44
  const ar = new AsyncResource('HTTP2ServerRequest');
45
  ar.runInAsyncScope(fn, this.koaApp, req, res);
46
  });
47
+ // HTTP2 p2p may break the load balancing
48
+ this.httpServer.updateSettings({
49
+ maxConcurrentStreams: 8,
50
+ });
51
  // useResourceBasedDefaultTracker();
52
 
53
  return this;
src/stand-alone/serp.ts CHANGED
@@ -45,6 +45,10 @@ export class SERPStandAloneServer extends KoaServer {
45
  const ar = new AsyncResource('HTTP2ServerRequest');
46
  ar.runInAsyncScope(fn, this.koaApp, req, res);
47
  });
 
 
 
 
48
  // useResourceBasedDefaultTracker();
49
 
50
  return this;
 
45
  const ar = new AsyncResource('HTTP2ServerRequest');
46
  ar.runInAsyncScope(fn, this.koaApp, req, res);
47
  });
48
+ // HTTP2 p2p may break the load balancing
49
+ this.httpServer.updateSettings({
50
+ maxConcurrentStreams: 50,
51
+ });
52
  // useResourceBasedDefaultTracker();
53
 
54
  return this;