Skip to content

Improve performance with reduced event loop blocking #8689

Open
@mtrezza

Description

@mtrezza

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions