Saturday, January 21, 2017

Rest, Streaming NATS and Grpc

So you want to make a platform based on micro-services and you want to make sure you find the best solution for messaging between those services.

I have found 2 complimentary technologies that seem worthy of inclusion in a micro-service communication strategy: gRPC and streaming NATS

Grpc provides a good solution for peer to peer RPC, whereas streaming NATS provides a messaging based solution for brokered communication.  Both of these flavors of invoking services seems to have a spot in a well formed solution.

What is interesting is that both streaming NATS and Grpc use google protocol buffers to solve the serialization problem for their form of micro-service communication.  

Building on some work being done at Docker, I have learned that REST/HTTP may not be suitable for all APIs.  Work being done by the NATS team echoes this.  Is REST the only option for micro-service communication: NO.  Is it appropriate for all micro-service work: NO.  Is is appropriate for consumer facing APIs - YES.

This conclusion is leading me down the path of some kind of hybrid solution where a communications plane is formed using Streaming NATS, NATS and GRPC for service to service communications and then a REST/OATH enabled set of APIs for external consumption.

Don't get me wrong REST/OATH is probably the right choice for consumer based APIs, but if you have real business problems that need to be solved by non-trivial services, it may be beneficial to look elsewhere in deciding on your service to service implementation details.




No comments: