I am doing a cpu intensive task on a dedicated server running on nodejs using the following procedure. Wondering if this is the correct approach (steps and approach as a whole) -
(Note - Time of completion of cpu intensive task is not important as long as it just gets done)
- Create a nodejs web server (WS) and another nodejs server for cpu intensive tasks (CPS) on different ports on the same machine
- WS sends cpu intensive task to CPS via a localhost http request
- CPS gets blocked, performs each task sequentially. WS is not directly affected by CPS being blocked (I am assuming this!)
Question1. What will happen if CPS has a huge queue which keeps on growing, due to requests sent by WS?
Question2. Is this a bad way of doing CPU intensive work? What will be a better solution?