loopbackio / loopbackio/loopback-next

Loopback/rest stringifies the responce which takes time and hangs the app

Offen
#10,529 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

Describe the bug

I have a loopback 4 application where I have API which returns large data 500000 records to explain the problem I have added the jaeger trace
image
if you see 1) is my API which has responded in 7-8 sec but the complete API took 12-13 sec
I want to know what happens in those remaining 5-6 sec?

I debugged the API and found out that the control goes to loopback/rest where it is stringifying the response that too using JSON.stringify() and not asyncrously
image

what happens is that during this time all other requests goes pending in my case liveliness check goes pending and as per my configuration if liveliness failed the container restarts .
how to fix this problem ?

Logs

No response

Additional information

Can we do a faster stringify?
or maybe make this asynchronous? I am ready to contribute

Reproduction

.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne beim im Issue beschriebenen loopback/rest-Response-Pfad und reproduziere das Verhalten mit einer API, die 500,000 Datensätze zurückgibt. Miss die in JSON.stringify verbrachte Zeit und ob Liveness-Prüfungen während der Serialisierung weiterhin ausstehen. Als abgeschlossen gilt die Aufgabe, wenn die gemeldete Response-Verzögerung und das Blockierungsverhalten von Requests behoben sind und das Ergebnis anhand desselben Szenarios mit einer großen Response verifiziert wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
node.js, typescript
Bereich
api, backend, performance
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.