Q
Q
QWATRIX2020-11-19 04:01:34
MongoDB
QWATRIX, 2020-11-19 04:01:34

Why does MongoDB shut down at high speeds?

I made a parser, set setInterval to 60 ms.

For each step, it should add from 500 records.

Everything runs at 2000ms but that's too slow for me.

I had the same story in MySQL when I set the interval too small, just nothing happened.
There are no errors, the code works, but a maximum of 1-2 records appear in the database, every 30 seconds.

I don’t know if it makes sense to add code, because it is standard on save(); by model.

Tell me what could be wrong in this situation, it seems to me that the matter is not in the code.
If someone met this problem, write how to solve it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2020-11-19
@QWATRIX

Use insertMany() https://stackoverflow.com/questions/16726330/mongo...
If Mongo is sick and doesn't have time to save, then you've arrived. Welcome to the world of sharding.
In a good way, no setInterval () is needed. We parsed the page, saved it, waited until it was saved, followed the next one. To split between parses, use setTimeout().

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question