Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance with reduced event loop blocking #8689

Open
3 tasks done
mtrezza opened this issue Jul 15, 2023 · 1 comment
Open
3 tasks done

Improve performance with reduced event loop blocking #8689

mtrezza opened this issue Jul 15, 2023 · 1 comment
Labels
type:feature New feature or improvement of existing feature

Comments

@mtrezza
Copy link
Member

mtrezza commented Jul 15, 2023

New Feature / Enhancement Checklist

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.

For example:

return objects.map(object => mongoObjectToParseObject(className, object, schema));

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.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Jul 15, 2023

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Jul 15, 2023
@mtrezza mtrezza changed the title Reduce event loop blocking Improve performance with reduced event loop blocking Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

1 participant