0

I am writing a node application which has two major tasks. Lets say task A (which reads from a caching layer and responds to requests) and B (which is the manipulation server responding to requests not being handled by task A). In the future I know that task A would be the more commonly used task while task B would be limited to new requests (almost 10% of the total load).

Given this situation (and also the different nature of task A (network intensive) and B(CPU intensive)), I thought of deploying task A and task B on different set of servers so that the two could be scaled up or down irrespective of the other.

Is this approach correct for the described scenario? If yes, then what are the general practices to communicate between different tiers of task A and B. Assuming that all requests need to be immediately fulfilled (ruling out deferred execution using queues).

Rahul Nanwani
  • 1,267
  • 1
  • 10
  • 21

1 Answers1

0

The answer to this question is going to depend on a LOT of factors, including things like your technology stack, your load profiles (how high are you trying to scale?), and your network infrastructure.

I will assume the simplest case, and that you have some tasks that are listening on URLs. /taskA and /taskB. You generally solve this by some sort of dispatch layer which will send the different URL requests to different back-end servers.

For example, putting Apache or NGinix as a reverse proxy in front of your application servers, and forwarding the request to the correct back-end server for servicing.

Rob Conklin
  • 8,806
  • 1
  • 19
  • 23
  • Thanks for your suggestion. But the case here is that taskB will never be accessed directly by a client. It would always be through taskA. I am not sure if Apache/Nginx infront of the application servers would be the right way in that case. Need your advice on it. Also, both the servers would be written in NodeJS (as of now). – Rahul Nanwani Mar 12 '16 at 03:14
  • Well then that's easy, expose TaskB on another server as a url, and call it over HTTP using JSON as the payload from TaskA. It is easy to work with JSON in NodeJS. – Rob Conklin Mar 12 '16 at 14:09