You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run gRPC client with @grpc/grpc-js v0.6.3, the run time is exponential depending on number of concurrent requests sent, and the code is in the busyloop, blocking the event loop and causing 100% CPU usage.
constfs=require('fs');constfirestore=require('@google-cloud/firestore');constgrpc=require('@grpc/grpc-js');constCOUNT=25;// 25 is already slow, 100 will never finishconstproject=JSON.parse(fs.readFileSync(process.env['GOOGLE_APPLICATION_CREDENTIALS'])).project_id;constcollectionId='test-collection';constdocumentIdPrefix='document-id-';functioncreateDoc(client){constdocumentId=documentIdPrefix+Math.random();constdocument={};constrequest={parent: `projects/${project}/databases/(default)/documents`,
collectionId,
documentId,
document,};returnclient.createDocument(request);}asyncfunctiontest(){constp=[];constclient=newfirestore.v1.FirestoreClient({grpc});for(leti=0;i<COUNT;++i){p.push(createDoc(client));}awaitPromise.all(p);console.log('Done!');}test().catch(err=>{console.error('Error!',err);});
Environment
OS name, version and architecture: OS X 10.14.6, but reproduces in Kokoro on Linux as well
Node version: 12.1.0
Node installation method: homebrew
If applicable, compiler version: N/A
Package name and version: @grpc/grpc-js v0.6.3
Additional context
When I use node --inspect to see what's going on, it shows the CPU time is spent in these deep recursive calls. Below is the console.trace() output:
Problem description
When I run gRPC client with
@grpc/grpc-js
v0.6.3, the run time is exponential depending on number of concurrent requests sent, and the code is in the busyloop, blocking the event loop and causing 100% CPU usage.It all works in
@grpc/grpc-js
v0.5.4.Reproduction steps
Repro with using Firestore client:
npm install @google-cloud/firestore @grpc/grpc-js export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_key.json
Environment
@grpc/grpc-js
v0.6.3Additional context
When I use
node --inspect
to see what's going on, it shows the CPU time is spent in these deep recursive calls. Below is theconsole.trace()
output:Cc: @schmidt-sebastian
The text was updated successfully, but these errors were encountered: