Good day,
I am new to Mongo DB and able to set up, which is up and running.
So far good.
I have huge data to write into to the mongoDb, I am using console app to write data. The console app is writing data with good speed, however mongo db freezes for few seconds (60-90 seconds) after pushing every 800-1000 records (randomly), this is very frustrating and time consuming as we need to push lots of data.
Please any one advise on this?
Thank you in advance.
Apologies for not providing the complete info.
Server is: Microsoft Windows 10 Pro With 64 Gig RAM ,16 Cores, using SSD drive with 2 TB.
I am using console app to write documents into Mongo DB, the source files are JSON. Everything is on the same SSD drive.
I am using latest mongo db version (4.4)
during the freeze time i cannot write any documents or search returns null .
I am using .Net drivers to push and pull data from Mongo Db
Please let me know if you want any specific information or screen shots, which I can provide.
By API, I mean which insert method? Are you inserting one by one or with bulk write? If your source is JSON files, is there any reason why you are not using https://docs.mongodb.com/database-tools/mongoimport/?
So your mongod and your client are on the same machine and reading and writing from and to the same disk. What is the CPU usage, disk usage when it freeze? Can you do anything else on this machine when your application freeze? Is it the same process that reads and writes from and to MongoDB?
Hi Steeve,Thanks again.Unfortunately, I cannot use once of import, we receive daily updates, & inserts daily from the customers.Some of them are already in the database and need to be updated (replaced), new ones inserted.
I am first checking if it exists if yes replace (ReplaceOne) else InsertOne.
Hi Steeve,
Thank you.
I don’t think it is the case.
Am also trying with bulk writes. Without any updates…
Adding documents to a list and writing to mongoDb using
if (lstToInsert.Count > 0)
await _books.BulkWriteAsync(lstToInsert);
This is also making db to freeze for a while…
I am using default configuration, May be some thing to with configuration ?