nodejs running out of memory processing csv files

后端 未结 1 586
遇见更好的自我
遇见更好的自我 2021-01-23 06:17

I\'ve read through a number of SO questions about nodejs running out of memory, but I haven\'t seen anything that sounds similar to my situation.

I\'m trying to process

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-23 06:51

    1. The script is not exiting cause you have an open connection to mongoose, after all the files has been processed you should close the connection and the script will finish.
    2. You have the right Idea of using streams but i think you missed something on the way, I suggest you the following article to update the streamInterface, and events. https://coderwall.com/p/ohjerg/read-large-text-files-in-nodejs

    3. An other source of problem could be the mongodb, it seems you make a lot of inserts, it could be related with the max i/o of mongodb that exhaust the memory.

    0 讨论(0)
提交回复
热议问题