parse-community / parse-community/parse-server
Improve performance with reduced event loop blocking
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Feature / Enhancement Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
Current Limitation
Parse Server, specifically the storage adapters, are using event loop blocking iterations which can become an performance bottleneck when dealing with many objects.
The transformation from JSON to Parse object is therefore often expensive, because the way it is synchronously implemented blocks the Node.js event loop until the whole array has been iterated over. We have seen in issues in the past (as a side-discovery) that the object transformation is resource intensive with a long transaction time; the synchronous processing is likely the reason.
Example
Add Parse Server option that unblocks the event loop after 10 JSON objects haven transformed to Parse Objects:
{
objectProcessingBatchSize: 10,
}
Feature / Enhancement Description
Add a new Parse Server option that allows to specify the batch size in which such iterations should happen. This allows the event loop to process other pending tasks after a batch has been processed. A developer can define how long Parse Server should claim the event loop and therefore can fine-tune complex request processing speeds vs. avg. request processing speed.
Alternatives / Workarounds
The developer needs to reduce the amount of Parse objects being handled by Parse Server per request, e.g. use pagination parameters like limit, skip. This is important in any case for many reasons, but there may be times in which a large number of objects needs to be fetched, and the developer would need to implement pagination themselves, instead of Parse Server doing this OOTB.
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 with src/Adapters/Storage/Mongo/MongoStorageAdapter.js around line 656 and trace the synchronous JSON-to-Parse-object transformation described in the issue. Review how storage adapters process object arrays and where Parse Server options are defined. Done means a configurable objectProcessingBatchSize allows pending event-loop work between batches without changing the returned objects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, databases, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100