简体   繁体   中英

Nodejs and batch jobs

I have an server side nodejs express app that responds to requests from front end clients. I need to implement a batch job that will run every hour. If I implement the batch job in the same service, does it mean that the service is 'occupied' until the cron job is completed and it will not be able to serve any requests? Should I create a separate service instead that will run the batch job?

If your batch job does not occupy the cpu 100%, then the server will still serve requests. Every time you do async io or wait for timers, there is plenty of time for the express root routine to deal with requests.

I don't know what your job and server are doing, look at it from Separation of Concerns . If the job scheduler and server belong together, then implement them together, otherwise I recommend to make two services out of it.

Have worked with a lot batch jobs using JAVA programming language and have processed and moved Millions of rows data as ETL tool. And have experience with Core NODE framework with Linux crone schedulers Its works much more faster then previous JAVA operations with low level servers while with java have used heavy configuration server still was facing memory issues.

You can implement crone jobs using NODEJS you have to make SH files and command with node to run JS files directly and call your DBs connection or CSVs to load or transfer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM