title: Queue vs Non Blocking I/O
body: <p>So, we're designing a new micro-service architecture. One of the biggest challenge is internal communication. For communication, in which response is required, we're using REST APIs. But for the services, which just wants to relay the information, this API processing is unnecessary overhead. </p>
  
  <p>One way is to use Queue. The service1 will push the information into a queue, and service2 can consume from there. Therefore service1 don't have to wait (unlike an API call). (If there is any error in processing the information, service2 can either inform via a callback URL to service1, or any other way; this is not a concern at this point [1])</p>
  
  <p>Now with Queue, there are two options, one is <em>RabbitMQ</em>. And another is <em>AWS SQS</em>. With RabbitMQ I've to worry about server-setup and everything (which can be done, but wants to avoid it). So after a POC of SQS, it seems like a good option, but the thing is SQS internally uses Rest APIs to communicate with AWS servers, at both point (service1 when pushing, service2 when consuming), there will be overhead. So now I'm thinking why not do it in NodeJS, service1 will hit the service2 with information. Service2 will respond immediately, acknowledging that it has received the information, if there is any error then [1]. </p>
  
  <p>Now Pros/Cons I could summarise is -</p>
  
  <h3>RabbitMQ</h3>
  
  <ul>
  <li>Easy to implement</li>
  <li>In case of unavailability of receiver, sender won't have to worry about retrying.</li>
  <li>Server Setup Cost + Maintenance (+ Tuning)</li>
  </ul>
  
  <h3>SQS</h3>
  
  <ul>
  <li>Easiest to implement</li>
  <li>Pricing</li>
  <li>Constant Polling for Messages</li>
  <li>Overhead at push/receive</li>
  </ul>
  
  <h3>Non-blocking APIs</h3>
  
  <ul>
  <li>No 3rd medium required for communication</li>
  <li>Service1 has to manage retry mechanism</li>
  <li>Relative to SQS, less overhead</li>
  <li>Information will be in-memory until processed</li>
  </ul>
  
  <p>So to some up, my question is, is it a good idea to go with Non-blocking APIs? Or which one will be better approach, in terms of making system scalable. </p>
  
  <p>Edit - 
  Can a PubSub provider like PubNub or Pusher can be used instead of Queue?</p>