Skip to content

nodejs CPU usage spike when saving large documents with mongoose #9588

@evgenyfedorenko

Description

@evgenyfedorenko

Do you want to request a feature or report a bug?
Bug probably

What is the current behavior?
When inserting many large documents experiencing a spike in CPU

If the current behavior is a bug, please provide the steps to reproduce.

Here is the schema I use:

{
  ticker: String,
  asks: [[Number]],
  bids: [[Number]],
  timestamp: String,
}

Asks and bids field can have up to 1000 arrays inside the outer array.
Both .save and insertMany cause this behavior.
Edit: If I use MongoDB Node.js Driver the CPU stays at normal levels

What is the expected behavior?
CPU spike should not occur.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node v12.19.0
Mongoose 5.10.1
MongoDB 4.4.0

Thank you for help!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions