Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
Parse Server 5 introduced schema hooks with the option databaseOptions.enableSchemaHooks
in #7214. There are potential performance downsides using the MongoDB change stream.
The MongoDB change stream works by setting a cursor on the MongoDB oplog collection. If many Parse Server instances are behind a load balancer, each one will open a change stream and set an oplog cursor. Each cursor adds an overhead to the MongoDB cluster resources in terms of CPU and RAM consumption.
There may be deployments in which schema hooks are disadvantageous. If the schema doesn't change much, it's unnecessary to constantly maintain the database cursors and the previous solution of pulling the schema in regular intervals may be much more economic. In hindsight, it seems that schema hooks should have been added as a optional feature, not a mandatory change.
Steps to reproduce
Run many server instances in a cluster with high write frequency and watch the MongoDB resource consumption increase significantly.
Actual Outcome
The developer has no choice and is forced to use schema hooks, or restart all server instances on every schema change.
Expected Outcome
The developer should have the choice of pulling the schema in defined intervals, as was possible with Parse Server <5.
Workaround
Disable databaseOptions.enableSchemaHooks
and restart server instances whenever schema changed.
Environment
Server
- Parse Server version:
5.7.2