loopbackio / loopbackio/loopback-next
Loopback/rest stringifies the responce which takes time and hangs the app
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
### 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

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

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
.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the loopback/rest response path described in the issue and reproduce it with an API returning 500,000 records. Measure the time spent in JSON.stringify and whether liveliness checks remain pending during serialization. Done means the reported response delay and request blocking behavior are addressed, with the result verified against the same large-response scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api, backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100