monitor process created using child_process.spawn and kill them when they overuse resources.

18 views
Skip to first unread message

jiten shah

unread,
Mar 31, 2016, 1:36:05 AM3/31/16
to nodejs
I am trying to build an online code editor for my professor - user writes code and submits code to a nodejs process which then uses nodejs's 'spawn' to start a new process. One of the cases is if a student writes a forever while loop - the new process will consume lot of cpu on the server. 

I want to restrict the new processes running in terms of cpu usage and memory usage. 

One of the solution I could think was having an external program which checks the cpu and memory usage of new processes and kills them when they cross the threshold.
But I was more keen on an inbuilt solution in nodejs.
Reply all
Reply to author
Forward
0 new messages